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