/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
uint32_t gfxFT2LockedFace::GetGlyph(uint32_t aCharCode) { if (MOZ_UNLIKELY(!mFace)) return 0;
#ifdef USE_FC_FREETYPE // FcFreeTypeCharIndex will search starting from the most recently // selected charmap. This can cause non-determistic behavior when more // than one charmap supports a character but with different glyphs, as // with older versions of MS Gothic, for example. Always prefer a Unicode // charmap, if there is one; failing that, try MS_SYMBOL. // (FcFreeTypeCharIndex usually does the appropriate Unicode conversion, // but some fonts have non-Roman glyphs for FT_ENCODING_APPLE_ROMAN // characters.) if (!mFace->charmap || (mFace->charmap->encoding != FT_ENCODING_UNICODE &&
mFace->charmap->encoding != FT_ENCODING_MS_SYMBOL)) { if (FT_Err_Ok != FT_Select_Charmap(mFace, FT_ENCODING_UNICODE) &&
FT_Err_Ok != FT_Select_Charmap(mFace, FT_ENCODING_MS_SYMBOL)) {
NS_WARNING("failed to select Unicode or symbol charmap");
}
}
uint32_t gfxFT2LockedFace::GetUVSGlyph(uint32_t aCharCode,
uint32_t aVariantSelector) {
MOZ_ASSERT(aVariantSelector, "aVariantSelector should not be NULL");
if (MOZ_UNLIKELY(!mFace)) return 0;
// This function is available from FreeType 2.3.6 (June 2008). static CharVariantFunction sGetCharVariantPtr = FindCharVariantFunction(); if (!sGetCharVariantPtr) return 0;
#ifdef USE_FC_FREETYPE // FcFreeTypeCharIndex may have changed the selected charmap. // FT_Face_GetCharVariantIndex needs a unicode charmap. if (!mFace->charmap || mFace->charmap->encoding != FT_ENCODING_UNICODE) {
FT_Select_Charmap(mFace, FT_ENCODING_UNICODE);
} #endif
gfxFT2LockedFace::CharVariantFunction
gfxFT2LockedFace::FindCharVariantFunction() { // This function is available from FreeType 2.3.6 (June 2008).
PRLibrary* lib = nullptr;
CharVariantFunction function = reinterpret_cast<CharVariantFunction>(
PR_FindFunctionSymbolAndLibrary("FT_Face_GetCharVariantIndex", &lib)); if (!lib) { return nullptr;
}
// Versions 2.4.0 to 2.4.3 crash if configured with // FT_CONFIG_OPTION_OLD_INTERNALS. Presence of the symbol FT_Alloc // indicates FT_CONFIG_OPTION_OLD_INTERNALS. if (major == 2 && minor == 4 && patch < 4 &&
PR_FindFunctionSymbol(lib, "FT_Alloc")) {
function = nullptr;
}
// Decrement the reference count incremented in // PR_FindFunctionSymbolAndLibrary.
PR_UnloadLibrary(lib);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.