| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #include "../../../include/fxge/fx_freetype.h" | 8 #include "../../../include/fxge/fx_freetype.h" |
| 9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
| 10 #include "text_int.h" | 10 #include "text_int.h" |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 if (pFont->IsVertical()) { | 1325 if (pFont->IsVertical()) { |
| 1326 ft_matrix.yx += ft_matrix.yy * skew / 100; | 1326 ft_matrix.yx += ft_matrix.yy * skew / 100; |
| 1327 } else { | 1327 } else { |
| 1328 ft_matrix.xy += -ft_matrix.xx * skew / 100; | 1328 ft_matrix.xy += -ft_matrix.xx * skew / 100; |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 if (pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { | 1331 if (pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { |
| 1332 pFont->AdjustMMParams(glyph_index, dest_width, pFont->GetSubstFont()
->m_Weight); | 1332 pFont->AdjustMMParams(glyph_index, dest_width, pFont->GetSubstFont()
->m_Weight); |
| 1333 } | 1333 } |
| 1334 } | 1334 } |
| 1335 int transflag = FXFT_Get_Face_Internal_Flag(m_Face); | |
| 1336 FXFT_Set_Transform(m_Face, &ft_matrix, 0); | 1335 FXFT_Set_Transform(m_Face, &ft_matrix, 0); |
| 1337 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BIT
MAP : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING); | 1336 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BIT
MAP : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING); |
| 1338 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); | 1337 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); |
| 1339 if (error) { | 1338 if (error) { |
| 1340 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1341 return NULL; | 1339 return NULL; |
| 1342 } | 1340 } |
| 1343 int weight = 0; | 1341 int weight = 0; |
| 1344 if (bUseCJKSubFont) { | 1342 if (bUseCJKSubFont) { |
| 1345 weight = pSubstFont->m_WeightCJK; | 1343 weight = pSubstFont->m_WeightCJK; |
| 1346 } else { | 1344 } else { |
| 1347 weight = pSubstFont ? pSubstFont->m_Weight : 0; | 1345 weight = pSubstFont ? pSubstFont->m_Weight : 0; |
| 1348 } | 1346 } |
| 1349 if (pSubstFont && !(pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && weight >
400) { | 1347 if (pSubstFont && !(pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && weight >
400) { |
| 1350 int index = (weight - 400) / 10; | 1348 int index = (weight - 400) / 10; |
| 1351 if (index >= WEIGHTPOW_ARRAY_SIZE) { | 1349 if (index >= WEIGHTPOW_ARRAY_SIZE) { |
| 1352 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1353 return NULL; | 1350 return NULL; |
| 1354 } | 1351 } |
| 1355 int level = 0; | 1352 int level = 0; |
| 1356 if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { | 1353 if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { |
| 1357 level = g_WeightPow_SHIFTJIS[index] * 2 * (FXSYS_abs((int)(ft_matrix
.xx)) + FXSYS_abs((int)(ft_matrix.xy))) / 36655; | 1354 level = g_WeightPow_SHIFTJIS[index] * 2 * (FXSYS_abs((int)(ft_matrix
.xx)) + FXSYS_abs((int)(ft_matrix.xy))) / 36655; |
| 1358 } else { | 1355 } else { |
| 1359 level = g_WeightPow_11[index] * (FXSYS_abs((int)(ft_matrix.xx)) + FX
SYS_abs((int)(ft_matrix.xy))) / 36655; | 1356 level = g_WeightPow_11[index] * (FXSYS_abs((int)(ft_matrix.xx)) + FX
SYS_abs((int)(ft_matrix.xy))) / 36655; |
| 1360 } | 1357 } |
| 1361 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); | 1358 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); |
| 1362 } | 1359 } |
| 1363 FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary, FT
_LCD_FILTER_DEFAULT); | 1360 FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->m_FTLibrary, FT
_LCD_FILTER_DEFAULT); |
| 1364 error = FXFT_Render_Glyph(m_Face, anti_alias); | 1361 error = FXFT_Render_Glyph(m_Face, anti_alias); |
| 1365 if (error) { | 1362 if (error) { |
| 1366 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1367 return NULL; | 1363 return NULL; |
| 1368 } | 1364 } |
| 1369 int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face)); | 1365 int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face)); |
| 1370 int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face)); | 1366 int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face)); |
| 1371 if (bmwidth > 2048 || bmheight > 2048) { | 1367 if (bmwidth > 2048 || bmheight > 2048) { |
| 1372 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1373 return NULL; | 1368 return NULL; |
| 1374 } | 1369 } |
| 1375 int dib_width = bmwidth; | 1370 int dib_width = bmwidth; |
| 1376 CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap; | 1371 CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap; |
| 1377 if (!pGlyphBitmap) { | 1372 if (!pGlyphBitmap) { |
| 1378 return NULL; | 1373 return NULL; |
| 1379 } | 1374 } |
| 1380 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, | 1375 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, |
| 1381 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b
ppMask : FXDIB_8bppMask); | 1376 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b
ppMask : FXDIB_8bppMask); |
| 1382 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); | 1377 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1399 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF
T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { | 1394 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF
T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { |
| 1400 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY
S_abs(src_pitch); | 1395 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY
S_abs(src_pitch); |
| 1401 for (int row = 0; row < bmheight; row ++) { | 1396 for (int row = 0; row < bmheight; row ++) { |
| 1402 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_
pitch, rowbytes); | 1397 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_
pitch, rowbytes); |
| 1403 } | 1398 } |
| 1404 } else { | 1399 } else { |
| 1405 _ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, des
t_pitch); | 1400 _ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, des
t_pitch); |
| 1406 _GammaAdjust(pDestBuf, bmwidth, bmheight, dest_pitch, CFX_GEModule::
Get()->GetTextGammaTable()); | 1401 _GammaAdjust(pDestBuf, bmwidth, bmheight, dest_pitch, CFX_GEModule::
Get()->GetTextGammaTable()); |
| 1407 } | 1402 } |
| 1408 } | 1403 } |
| 1409 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1410 return pGlyphBitmap; | 1404 return pGlyphBitmap; |
| 1411 } | 1405 } |
| 1412 FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, | 1406 FX_BOOL _OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, |
| 1413 int glyph_index, FX_ARGB argb) | 1407 int glyph_index, FX_ARGB argb) |
| 1414 { | 1408 { |
| 1415 CFX_DIBitmap* pDib = (CFX_DIBitmap*)dib; | 1409 CFX_DIBitmap* pDib = (CFX_DIBitmap*)dib; |
| 1416 FXFT_Face face = pFont->GetFace(); | 1410 FXFT_Face face = pFont->GetFace(); |
| 1417 int error = FXFT_Load_Glyph(face, glyph_index, FXFT_LOAD_NO_BITMAP); | 1411 int error = FXFT_Load_Glyph(face, glyph_index, FXFT_LOAD_NO_BITMAP); |
| 1418 if (error) { | 1412 if (error) { |
| 1419 return FALSE; | 1413 return FALSE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1441 return TRUE; | 1435 return TRUE; |
| 1442 } | 1436 } |
| 1443 FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, | 1437 FX_BOOL OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, |
| 1444 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u
nsigned long argb) | 1438 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u
nsigned long argb) |
| 1445 { | 1439 { |
| 1446 if (!pFont) { | 1440 if (!pFont) { |
| 1447 return FALSE; | 1441 return FALSE; |
| 1448 } | 1442 } |
| 1449 FXFT_Face face = pFont->GetFace(); | 1443 FXFT_Face face = pFont->GetFace(); |
| 1450 FXFT_Select_Charmap(pFont->m_Face, FXFT_ENCODING_UNICODE); | 1444 FXFT_Select_Charmap(pFont->m_Face, FXFT_ENCODING_UNICODE); |
| 1451 int transflag = FXFT_Get_Face_Internal_Flag(pFont->m_Face); | |
| 1452 if (pText_matrix) { | 1445 if (pText_matrix) { |
| 1453 FXFT_Matrix ft_matrix; | 1446 FXFT_Matrix ft_matrix; |
| 1454 ft_matrix.xx = (signed long)(pText_matrix->a / 64 * 65536); | 1447 ft_matrix.xx = (signed long)(pText_matrix->a / 64 * 65536); |
| 1455 ft_matrix.xy = (signed long)(pText_matrix->c / 64 * 65536); | 1448 ft_matrix.xy = (signed long)(pText_matrix->c / 64 * 65536); |
| 1456 ft_matrix.yx = (signed long)(pText_matrix->b / 64 * 65536); | 1449 ft_matrix.yx = (signed long)(pText_matrix->b / 64 * 65536); |
| 1457 ft_matrix.yy = (signed long)(pText_matrix->d / 64 * 65536); | 1450 ft_matrix.yy = (signed long)(pText_matrix->d / 64 * 65536); |
| 1458 FXFT_Set_Transform(face, &ft_matrix, 0); | 1451 FXFT_Set_Transform(face, &ft_matrix, 0); |
| 1459 } | 1452 } |
| 1460 FX_FLOAT x_pos = 0; | 1453 FX_FLOAT x_pos = 0; |
| 1461 for (; *text != 0; text ++) { | 1454 for (; *text != 0; text ++) { |
| 1462 FX_WCHAR unicode = *text; | 1455 FX_WCHAR unicode = *text; |
| 1463 int glyph_index = FXFT_Get_Char_Index(pFont->m_Face, unicode); | 1456 int glyph_index = FXFT_Get_Char_Index(pFont->m_Face, unicode); |
| 1464 if (glyph_index <= 0) { | 1457 if (glyph_index <= 0) { |
| 1465 continue; | 1458 continue; |
| 1466 } | 1459 } |
| 1467 int err = FXFT_Load_Glyph(pFont->m_Face, glyph_index, FXFT_LOAD_NO_SCALE
| FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH); | 1460 int err = FXFT_Load_Glyph(pFont->m_Face, glyph_index, FXFT_LOAD_NO_SCALE
| FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH); |
| 1468 if (err) { | 1461 if (err) { |
| 1469 continue; | 1462 continue; |
| 1470 } | 1463 } |
| 1471 int w = FXFT_Get_Glyph_HoriAdvance(pFont->m_Face); | 1464 int w = FXFT_Get_Glyph_HoriAdvance(pFont->m_Face); |
| 1472 int em = FXFT_Get_Face_UnitsPerEM(pFont->m_Face); | 1465 int em = FXFT_Get_Face_UnitsPerEM(pFont->m_Face); |
| 1473 FX_FLOAT x1, y1; | 1466 FX_FLOAT x1, y1; |
| 1474 pText_matrix->Transform(x_pos, 0, x1, y1); | 1467 pText_matrix->Transform(x_pos, 0, x1, y1); |
| 1475 _OutputGlyph(dib, (int)x1 + x, (int) - y1 + y, pFont, | 1468 _OutputGlyph(dib, (int)x1 + x, (int) - y1 + y, pFont, |
| 1476 glyph_index, argb); | 1469 glyph_index, argb); |
| 1477 x_pos += (FX_FLOAT)w / em; | 1470 x_pos += (FX_FLOAT)w / em; |
| 1478 } | 1471 } |
| 1479 FXFT_Set_Face_Internal_Flag(pFont->m_Face, transflag); | |
| 1480 return TRUE; | 1472 return TRUE; |
| 1481 } | 1473 } |
| 1482 FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, | 1474 FX_BOOL OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, |
| 1483 CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsign
ed long argb) | 1475 CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsign
ed long argb) |
| 1484 { | 1476 { |
| 1485 FXFT_Matrix ft_matrix; | 1477 FXFT_Matrix ft_matrix; |
| 1486 if (pMatrix) { | 1478 if (pMatrix) { |
| 1487 ft_matrix.xx = (signed long)(pMatrix->a * font_size / 64 * 65536); | 1479 ft_matrix.xx = (signed long)(pMatrix->a * font_size / 64 * 65536); |
| 1488 ft_matrix.xy = (signed long)(pMatrix->c * font_size / 64 * 65536); | 1480 ft_matrix.xy = (signed long)(pMatrix->c * font_size / 64 * 65536); |
| 1489 ft_matrix.yx = (signed long)(pMatrix->b * font_size / 64 * 65536); | 1481 ft_matrix.yx = (signed long)(pMatrix->b * font_size / 64 * 65536); |
| 1490 ft_matrix.yy = (signed long)(pMatrix->d * font_size / 64 * 65536); | 1482 ft_matrix.yy = (signed long)(pMatrix->d * font_size / 64 * 65536); |
| 1491 } else { | 1483 } else { |
| 1492 ft_matrix.xx = (signed long)(font_size / 64 * 65536); | 1484 ft_matrix.xx = (signed long)(font_size / 64 * 65536); |
| 1493 ft_matrix.xy = ft_matrix.yx = 0; | 1485 ft_matrix.xy = ft_matrix.yx = 0; |
| 1494 ft_matrix.yy = (signed long)(font_size / 64 * 65536); | 1486 ft_matrix.yy = (signed long)(font_size / 64 * 65536); |
| 1495 } | 1487 } |
| 1496 int transflag = FXFT_Get_Face_Internal_Flag(pFont->m_Face); | |
| 1497 FXFT_Set_Transform(pFont->m_Face, &ft_matrix, 0); | 1488 FXFT_Set_Transform(pFont->m_Face, &ft_matrix, 0); |
| 1498 FX_BOOL ret = _OutputGlyph(dib, x, y, pFont, | 1489 FX_BOOL ret = _OutputGlyph(dib, x, y, pFont, |
| 1499 glyph_index, argb); | 1490 glyph_index, argb); |
| 1500 FXFT_Set_Face_Internal_Flag(pFont->m_Face, transflag); | |
| 1501 return ret; | 1491 return ret; |
| 1502 } | 1492 } |
| 1503 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph
_index, int dest_width) | 1493 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph
_index, int dest_width) |
| 1504 { | 1494 { |
| 1505 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) { | 1495 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) { |
| 1506 return NULL; | 1496 return NULL; |
| 1507 } | 1497 } |
| 1508 CFX_PathData* pGlyphPath = NULL; | 1498 CFX_PathData* pGlyphPath = NULL; |
| 1509 FX_LPVOID key; | 1499 FX_LPVOID key; |
| 1510 if (pFont->GetSubstFont()) | 1500 if (pFont->GetSubstFont()) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1637 if (m_bVertical) { | 1627 if (m_bVertical) { |
| 1638 ft_matrix.yx += ft_matrix.yy * skew / 100; | 1628 ft_matrix.yx += ft_matrix.yy * skew / 100; |
| 1639 } else { | 1629 } else { |
| 1640 ft_matrix.xy += -ft_matrix.xx * skew / 100; | 1630 ft_matrix.xy += -ft_matrix.xx * skew / 100; |
| 1641 } | 1631 } |
| 1642 } | 1632 } |
| 1643 if (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { | 1633 if (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { |
| 1644 AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight); | 1634 AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight); |
| 1645 } | 1635 } |
| 1646 } | 1636 } |
| 1647 int transflag = FXFT_Get_Face_Internal_Flag(m_Face); | |
| 1648 FXFT_Set_Transform(m_Face, &ft_matrix, 0); | 1637 FXFT_Set_Transform(m_Face, &ft_matrix, 0); |
| 1649 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BIT
MAP : FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING; | 1638 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) ? FXFT_LOAD_NO_BIT
MAP : FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING; |
| 1650 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); | 1639 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); |
| 1651 if (error) { | 1640 if (error) { |
| 1652 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1653 return NULL; | 1641 return NULL; |
| 1654 } | 1642 } |
| 1655 if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && m_pSu
bstFont->m_Weight > 400) { | 1643 if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && m_pSu
bstFont->m_Weight > 400) { |
| 1656 int index = (m_pSubstFont->m_Weight - 400) / 10; | 1644 int index = (m_pSubstFont->m_Weight - 400) / 10; |
| 1657 if (index >= WEIGHTPOW_ARRAY_SIZE) | 1645 if (index >= WEIGHTPOW_ARRAY_SIZE) |
| 1658 index = WEIGHTPOW_ARRAY_SIZE - 1; | 1646 index = WEIGHTPOW_ARRAY_SIZE - 1; |
| 1659 int level = 0; | 1647 int level = 0; |
| 1660 if (m_pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { | 1648 if (m_pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { |
| 1661 level = g_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655; | 1649 level = g_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655; |
| 1662 } else { | 1650 } else { |
| 1663 level = g_WeightPow[index] * 2; | 1651 level = g_WeightPow[index] * 2; |
| 1664 } | 1652 } |
| 1665 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); | 1653 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); |
| 1666 } | 1654 } |
| 1667 FXFT_Outline_Funcs funcs; | 1655 FXFT_Outline_Funcs funcs; |
| 1668 funcs.move_to = _Outline_MoveTo; | 1656 funcs.move_to = _Outline_MoveTo; |
| 1669 funcs.line_to = _Outline_LineTo; | 1657 funcs.line_to = _Outline_LineTo; |
| 1670 funcs.conic_to = _Outline_ConicTo; | 1658 funcs.conic_to = _Outline_ConicTo; |
| 1671 funcs.cubic_to = _Outline_CubicTo; | 1659 funcs.cubic_to = _Outline_CubicTo; |
| 1672 funcs.shift = 0; | 1660 funcs.shift = 0; |
| 1673 funcs.delta = 0; | 1661 funcs.delta = 0; |
| 1674 OUTLINE_PARAMS params; | 1662 OUTLINE_PARAMS params; |
| 1675 params.m_bCount = TRUE; | 1663 params.m_bCount = TRUE; |
| 1676 params.m_PointCount = 0; | 1664 params.m_PointCount = 0; |
| 1677 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); | 1665 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); |
| 1678 if (params.m_PointCount == 0) { | 1666 if (params.m_PointCount == 0) { |
| 1679 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1680 return NULL; | 1667 return NULL; |
| 1681 } | 1668 } |
| 1682 CFX_PathData* pPath = FX_NEW CFX_PathData; | 1669 CFX_PathData* pPath = FX_NEW CFX_PathData; |
| 1683 if (!pPath) { | 1670 if (!pPath) { |
| 1684 return NULL; | 1671 return NULL; |
| 1685 } | 1672 } |
| 1686 pPath->SetPointCount(params.m_PointCount); | 1673 pPath->SetPointCount(params.m_PointCount); |
| 1687 params.m_bCount = FALSE; | 1674 params.m_bCount = FALSE; |
| 1688 params.m_PointCount = 0; | 1675 params.m_PointCount = 0; |
| 1689 params.m_pPoints = pPath->GetPoints(); | 1676 params.m_pPoints = pPath->GetPoints(); |
| 1690 params.m_CurX = params.m_CurY = 0; | 1677 params.m_CurX = params.m_CurY = 0; |
| 1691 params.m_CoordUnit = 64 * 64.0; | 1678 params.m_CoordUnit = 64 * 64.0; |
| 1692 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); | 1679 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); |
| 1693 _Outline_CheckEmptyContour(¶ms); | 1680 _Outline_CheckEmptyContour(¶ms); |
| 1694 pPath->TrimPoints(params.m_PointCount); | 1681 pPath->TrimPoints(params.m_PointCount); |
| 1695 if (params.m_PointCount) { | 1682 if (params.m_PointCount) { |
| 1696 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; | 1683 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; |
| 1697 } | 1684 } |
| 1698 FXFT_Set_Face_Internal_Flag(m_Face, transflag); | |
| 1699 return pPath; | 1685 return pPath; |
| 1700 } | 1686 } |
| 1701 void _CFX_UniqueKeyGen::Generate(int count, ...) | 1687 void _CFX_UniqueKeyGen::Generate(int count, ...) |
| 1702 { | 1688 { |
| 1703 va_list argList; | 1689 va_list argList; |
| 1704 va_start(argList, count); | 1690 va_start(argList, count); |
| 1705 for (int i = 0; i < count; i ++) { | 1691 for (int i = 0; i < count; i ++) { |
| 1706 int p = va_arg(argList, int); | 1692 int p = va_arg(argList, int); |
| 1707 ((FX_DWORD*)m_Key)[i] = p; | 1693 ((FX_DWORD*)m_Key)[i] = p; |
| 1708 } | 1694 } |
| 1709 va_end(argList); | 1695 va_end(argList); |
| 1710 m_KeyLen = count * sizeof(FX_DWORD); | 1696 m_KeyLen = count * sizeof(FX_DWORD); |
| 1711 } | 1697 } |
| OLD | NEW |