WXFontType wxFont::GetFontTypeC(WXDisplay* display) const { #if wxMOTIF_USE_RENDER_TABLE return Ok() ? GetRenderTable(display) : NULL; #else return Ok() ? XmFontListCopy( (XmFontList)GetFontList(1.0, display) ) : NULL; #endif }
already_AddRefed<gfxOS2Font> gfxOS2Platform::FindFontForChar(PRUint32 aCh, gfxOS2Font *aFont) { #ifdef DEBUG_thebes printf("gfxOS2Platform::FindFontForChar(%d, ...)\n", aCh); #endif // is codepoint with no matching font? return null immediately if (mCodepointsWithNoFonts.test(aCh)) { return nsnull; } // the following is not very clever but it's a quick fix to search all fonts // (one should instead cache the charmaps as done on Mac and Win) // just continue to append all fonts known to the system nsTArray<nsString> fontList; nsCAutoString generic; nsresult rv = GetFontList(aFont->GetStyle()->langGroup, generic, fontList); if (NS_SUCCEEDED(rv)) { // start at 3 to skip over the generic entries for (PRUint32 i = 3; i < fontList.Length(); i++) { #ifdef DEBUG_thebes printf("searching in entry i=%d (%s)\n", i, NS_LossyConvertUTF16toASCII(fontList[i]).get()); #endif nsRefPtr<gfxOS2Font> font = gfxOS2Font::GetOrMakeFont(fontList[i], aFont->GetStyle()); if (!font) continue; FT_Face face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont()); if (!face || !face->charmap) { if (face) cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); continue; } FT_UInt gid = FT_Get_Char_Index(face, aCh); // find the glyph id if (gid != 0) { // this is the font cairo_ft_scaled_font_unlock_face(font->CairoScaledFont()); return font.forget(); } } } // no match found, so add to the set of non-matching codepoints mCodepointsWithNoFonts.set(aCh); return nsnull; }