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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), | 1114 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), |
1115 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias, 3); | 1115 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias, 3); |
1116 } | 1116 } |
1117 #endif | 1117 #endif |
1118 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); | 1118 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); |
1119 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 1119 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
1120 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt
yle, dest_width, anti_alias); | 1120 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt
yle, dest_width, anti_alias); |
1121 #else | 1121 #else |
1122 if (text_flags & FXTEXT_NO_NATIVETEXT) { | 1122 if (text_flags & FXTEXT_NO_NATIVETEXT) { |
1123 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo
ntStyle, dest_width, anti_alias); | 1123 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo
ntStyle, dest_width, anti_alias); |
| 1124 } |
| 1125 CFX_GlyphBitmap* pGlyphBitmap; |
| 1126 CFX_SizeGlyphCache* pSizeCache = NULL; |
| 1127 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { |
| 1128 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&
)pGlyphBitmap)) { |
| 1129 return pGlyphBitmap; |
| 1130 } |
| 1131 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_
width, anti_alias); |
| 1132 if (pGlyphBitmap) { |
| 1133 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi
tmap); |
| 1134 return pGlyphBitmap; |
| 1135 } |
1124 } else { | 1136 } else { |
1125 CFX_GlyphBitmap* pGlyphBitmap; | 1137 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_
width, anti_alias); |
1126 CFX_SizeGlyphCache* pSizeCache = NULL; | 1138 if (pGlyphBitmap) { |
1127 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { | 1139 pSizeCache = new CFX_SizeGlyphCache; |
1128 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (vo
id*&)pGlyphBitmap)) { | 1140 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); |
1129 return pGlyphBitmap; | 1141 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi
tmap); |
1130 } | 1142 return pGlyphBitmap; |
1131 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); | |
1132 if (pGlyphBitmap) { | |
1133 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly
phBitmap); | |
1134 return pGlyphBitmap; | |
1135 } | |
1136 } else { | |
1137 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); | |
1138 if (pGlyphBitmap) { | |
1139 pSizeCache = FX_NEW CFX_SizeGlyphCache; | |
1140 if (pSizeCache == NULL)»{ | |
1141 return NULL; | |
1142 } | |
1143 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); | |
1144 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly
phBitmap); | |
1145 return pGlyphBitmap; | |
1146 } | |
1147 } | 1143 } |
1148 if (pFont->GetSubstFont()) | |
1149 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), | |
1150 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias, | |
1151 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont
()->m_ItalicAngle, pFont->IsVertical()); | |
1152 else | |
1153 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), | |
1154 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias); | |
1155 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); | |
1156 text_flags |= FXTEXT_NO_NATIVETEXT; | |
1157 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo
ntStyle, dest_width, anti_alias); | |
1158 } | 1144 } |
| 1145 if (pFont->GetSubstFont()) |
| 1146 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
| 1147 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de
st_width, anti_alias, |
| 1148 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()->
m_ItalicAngle, pFont->IsVertical()); |
| 1149 else |
| 1150 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
| 1151 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de
st_width, anti_alias); |
| 1152 CFX_ByteStringC FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); |
| 1153 text_flags |= FXTEXT_NO_NATIVETEXT; |
| 1154 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, bFontS
tyle, dest_width, anti_alias); |
1159 #endif | 1155 #endif |
1160 } | 1156 } |
1161 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() | 1157 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() |
1162 { | 1158 { |
1163 FX_POSITION pos = m_GlyphMap.GetStartPosition(); | 1159 FX_POSITION pos = m_GlyphMap.GetStartPosition(); |
1164 void* Key; | 1160 void* Key; |
1165 CFX_GlyphBitmap* pGlyphBitmap = NULL; | 1161 CFX_GlyphBitmap* pGlyphBitmap = NULL; |
1166 while(pos) { | 1162 while(pos) { |
1167 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); | 1163 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); |
1168 delete pGlyphBitmap; | 1164 delete pGlyphBitmap; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 { | 1680 { |
1685 va_list argList; | 1681 va_list argList; |
1686 va_start(argList, count); | 1682 va_start(argList, count); |
1687 for (int i = 0; i < count; i ++) { | 1683 for (int i = 0; i < count; i ++) { |
1688 int p = va_arg(argList, int); | 1684 int p = va_arg(argList, int); |
1689 ((FX_DWORD*)m_Key)[i] = p; | 1685 ((FX_DWORD*)m_Key)[i] = p; |
1690 } | 1686 } |
1691 va_end(argList); | 1687 va_end(argList); |
1692 m_KeyLen = count * sizeof(FX_DWORD); | 1688 m_KeyLen = count * sizeof(FX_DWORD); |
1693 } | 1689 } |
OLD | NEW |