for(i = 0; i < ft_face->num_charmaps; i++)
{
- if(ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL)
+ if (ft_face->charmaps[i]->platform_id == TT_PLATFORM_MICROSOFT &&
+ ft_face->charmaps[i]->encoding == FT_ENCODING_MS_SYMBOL)
+ {
return TRUE;
+ }
}
return FALSE;
}
for (n = 0; n < face->num_charmaps; n++)
{
charmap = face->charmaps[n];
- DPRINT("Found charmap encoding: %i\n", charmap->encoding);
- if (charmap->encoding != 0)
+ if (charmap->encoding == FT_ENCODING_UNICODE)
{
found = charmap;
break;
}
}
if (!found)
+ {
+ for (n = 0; n < face->num_charmaps; n++)
+ {
+ charmap = face->charmaps[n];
+ if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
+ {
+ found = charmap;
+ break;
+ }
+ }
+ }
+ if (!found)
{
DPRINT1("WARNING: Could not find desired charmap!\n");
}
else
{
+ DPRINT("Found charmap encoding: %i\n", found->encoding);
error = FT_Set_Charmap(face, found);
if (error)
{
return TRUE;
}
+static inline FT_UInt FASTCALL
+get_glyph_index_symbol(FT_Face ft_face, UINT glyph)
+{
+ FT_UInt ret;
+
+ if (glyph < 0x100) glyph += 0xf000;
+ /* there are a number of old pre-Unicode "broken" TTFs, which
+ do have symbols at U+00XX instead of U+f0XX */
+ if (!(ret = FT_Get_Char_Index(ft_face, glyph)))
+ ret = FT_Get_Char_Index(ft_face, glyph - 0xf000);
+
+ return ret;
+}
+
+static inline FT_UInt FASTCALL
+get_glyph_index(FT_Face ft_face, UINT glyph)
+{
+ FT_UInt ret;
+
+ if (face_has_symbol_charmap(ft_face))
+ {
+ ret = get_glyph_index_symbol(ft_face, glyph);
+ if (ret != 0)
+ return ret;
+ }
+
+ return FT_Get_Char_Index(ft_face, glyph);
+}
+
+static inline FT_UInt FASTCALL
+get_glyph_index_flagged(FT_Face face, FT_ULong code, DWORD indexed_flag, DWORD flags)
+{
+ FT_UInt glyph_index;
+ if (flags & indexed_flag)
+ {
+ glyph_index = code;
+ }
+ else
+ {
+ glyph_index = get_glyph_index(face, code);
+ }
+ return glyph_index;
+}
/*
* Based on WineEngGetGlyphOutline
TEXTOBJ_UnlockText(TextObj);
- if (iFormat & GGO_GLYPH_INDEX)
- {
- glyph_index = wch;
- iFormat &= ~GGO_GLYPH_INDEX;
- }
- else glyph_index = FT_Get_Char_Index(ft_face, wch);
+ glyph_index = get_glyph_index_flagged(ft_face, wch, GGO_GLYPH_INDEX, iFormat);
+ iFormat &= ~GGO_GLYPH_INDEX;
if (orientation || (iFormat != GGO_METRICS && iFormat != GGO_BITMAP) || aveWidth || pmat2)
load_flags |= FT_LOAD_NO_BITMAP;
for (i = 0; i < Count; i++)
{
- if (fl & GTEF_INDICES)
- glyph_index = *String;
- else
- glyph_index = FT_Get_Char_Index(face, *String);
+ glyph_index = get_glyph_index_flagged(face, *String, GTEF_INDICES, fl);
if (EmuBold || EmuItalic)
realglyph = NULL;
for (i = iStart; i < Count; i++)
{
- if (fuOptions & ETO_GLYPH_INDEX)
- glyph_index = *TempText;
- else
- glyph_index = FT_Get_Char_Index(face, *TempText);
+ glyph_index = get_glyph_index_flagged(face, *TempText, ETO_GLYPH_INDEX, fuOptions);
if (EmuBold || EmuItalic)
realglyph = NULL;
BackgroundLeft = (RealXStart + 32) >> 6;
for (i = 0; i < Count; ++i)
{
- if (fuOptions & ETO_GLYPH_INDEX)
- glyph_index = String[i];
- else
- glyph_index = FT_Get_Char_Index(face, String[i]);
+ glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
if (error)
BackgroundLeft = (RealXStart + 32) >> 6;
for (i = 0; i < Count; ++i)
{
- if (fuOptions & ETO_GLYPH_INDEX)
- glyph_index = String[i];
- else
- glyph_index = FT_Get_Char_Index(face, String[i]);
+ glyph_index = get_glyph_index_flagged(face, String[i], ETO_GLYPH_INDEX, fuOptions);
if (EmuBold || EmuItalic)
realglyph = NULL;
if (Safepwch)
{
- if (fl & GCABCW_INDICES)
- glyph_index = Safepwch[i - FirstChar];
- else
- glyph_index = FT_Get_Char_Index(face, Safepwch[i - FirstChar]);
+ glyph_index = get_glyph_index_flagged(face, Safepwch[i - FirstChar], GCABCW_INDICES, fl);
}
else
{
- if (fl & GCABCW_INDICES)
- glyph_index = i;
- else
- glyph_index = FT_Get_Char_Index(face, i);
+ glyph_index = get_glyph_index_flagged(face, i, GCABCW_INDICES, fl);
}
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
{
if (Safepwc)
{
- if (fl & GCW_INDICES)
- glyph_index = Safepwc[i - FirstChar];
- else
- glyph_index = FT_Get_Char_Index(face, Safepwc[i - FirstChar]);
+ glyph_index = get_glyph_index_flagged(face, Safepwc[i - FirstChar], GCW_INDICES, fl);
}
else
{
- if (fl & GCW_INDICES)
- glyph_index = i;
- else
- glyph_index = FT_Get_Char_Index(face, i);
+ glyph_index = get_glyph_index_flagged(face, i, GCW_INDICES, fl);
}
FT_Load_Glyph(face, glyph_index, FT_LOAD_DEFAULT);
if (!fl)
if (FT_IS_SFNT(Face))
{
TT_OS2 *pOS2 = FT_Get_Sfnt_Table(Face, ft_sfnt_os2);
- DefChar = (pOS2->usDefaultChar ? FT_Get_Char_Index(Face, pOS2->usDefaultChar) : 0);
+ DefChar = (pOS2->usDefaultChar ? get_glyph_index(Face, pOS2->usDefaultChar) : 0);
}
else
{
for (i = 0; i < cwc; i++)
{
- Buffer[i] = FT_Get_Char_Index(FontGDI->SharedFace->Face, Safepwc[i]);
+ Buffer[i] = get_glyph_index(FontGDI->SharedFace->Face, Safepwc[i]);
if (Buffer[i] == 0)
{
Buffer[i] = DefChar;