Bug 1434699 - Don't use dlsym() to look up FreeType functions when building with MOZ_TREE_FREETYPE. r=lsalzman

This commit is contained in:
Jonathan Kew 2018-02-01 15:28:09 +00:00
Родитель 43118373ed
Коммит 5b9b689254
3 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -726,7 +726,10 @@ _cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled)
}
if (unscaled->var_coords) {
typedef FT_UInt (*SetCoordsFunc)(FT_Face, FT_UInt, FT_Fixed*);
#if MOZ_TREE_FREETYPE
FT_Set_Var_Design_Coordinates(face, unscaled->num_var_coords, unscaled->var_coords);
#else
typedef FT_Error (*SetCoordsFunc)(FT_Face, FT_UInt, FT_Fixed*);
static SetCoordsFunc setCoords;
static cairo_bool_t firstTime = TRUE;
if (firstTime) {
@ -736,6 +739,7 @@ _cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled)
if (setCoords) {
(*setCoords)(face, unscaled->num_var_coords, unscaled->var_coords);
}
#endif
}
unscaled->face = face;

Просмотреть файл

@ -226,7 +226,10 @@ gfxFT2FontBase::InitMetrics()
if (!mStyle.variationSettings.IsEmpty()) {
SetupVarCoords(face, mStyle.variationSettings, &mCoords);
if (!mCoords.IsEmpty()) {
typedef FT_UInt (*SetCoordsFunc)(FT_Face, FT_UInt, FT_Fixed*);
#if MOZ_TREE_FREETYPE
FT_Set_Var_Design_Coordinates(face, mCoords.Length(), mCoords.Elements());
#else
typedef FT_Error (*SetCoordsFunc)(FT_Face, FT_UInt, FT_Fixed*);
static SetCoordsFunc setCoords;
static bool firstTime = true;
if (firstTime) {
@ -237,6 +240,7 @@ gfxFT2FontBase::InitMetrics()
if (setCoords) {
(*setCoords)(face, mCoords.Length(), mCoords.Elements());
}
#endif
}
}
@ -625,8 +629,12 @@ gfxFT2FontBase::SetupVarCoords(FT_Face aFace,
aCoords->TruncateLength(0);
if (aFace->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS) {
typedef FT_Error (*GetVarFunc)(FT_Face, FT_MM_Var**);
static GetVarFunc getVar;
typedef FT_Error (*DoneVarFunc)(FT_Library, FT_MM_Var*);
#if MOZ_TREE_FREETYPE
GetVarFunc getVar = &FT_Get_MM_Var;
DoneVarFunc doneVar = &FT_Done_MM_Var;
#else
static GetVarFunc getVar;
static DoneVarFunc doneVar;
static bool firstTime = true;
if (firstTime) {
@ -634,6 +642,7 @@ gfxFT2FontBase::SetupVarCoords(FT_Face aFace,
getVar = (GetVarFunc)dlsym(RTLD_DEFAULT, "FT_Get_MM_Var");
doneVar = (DoneVarFunc)dlsym(RTLD_DEFAULT, "FT_Done_MM_Var");
}
#endif
FT_MM_Var* ftVar;
if (getVar && FT_Err_Ok == (*getVar)(aFace, &ftVar)) {
for (unsigned i = 0; i < ftVar->num_axis; ++i) {

Просмотреть файл

@ -373,8 +373,13 @@ InitializeVarFuncs()
return;
}
sInitializedVarFuncs = true;
#if MOZ_TREE_FREETYPE
sGetVar = &FT_Get_MM_Var;
sDoneVar = &FT_Done_MM_Var;
#else
sGetVar = (GetVarFunc)dlsym(RTLD_DEFAULT, "FT_Get_MM_Var");
sDoneVar = (DoneVarFunc)dlsym(RTLD_DEFAULT, "FT_Done_MM_Var");
#endif
}
gfxFontconfigFontEntry::~gfxFontconfigFontEntry()