Skip to content

Commit

Permalink
Revert "prefer to use FreeType for pango_cairo_font_map"
Browse files Browse the repository at this point in the history
This reverts commit 345e5ee.
  • Loading branch information
zdenop committed Oct 20, 2018
1 parent 276c684 commit 1b2bda6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/training/pango_font_info.cpp
Expand Up @@ -117,14 +117,6 @@ void PangoFontInfo::SoftInitFontConfig() {
}
}

PangoFontMap* PangoFontInfo::get_font_map() {
PangoFontMap* font_map =
pango_cairo_font_map_new_for_font_type(CAIRO_FONT_TYPE_FT);
if (!font_map) // cairo withtout support of Freetype?
font_map = pango_cairo_font_map_get_default();
return font_map;
}

// Re-initializes font config, whether or not already initialized.
// If already initialized, any existing cache is deleted, just to be sure.
/* static */
Expand Down Expand Up @@ -171,7 +163,7 @@ void PangoFontInfo::HardInitFontConfig(const std::string& fonts_dir,
static void ListFontFamilies(PangoFontFamily*** families,
int* n_families) {
PangoFontInfo::SoftInitFontConfig();
PangoFontMap* font_map = PangoFontInfo::get_font_map();
PangoFontMap* font_map = pango_cairo_font_map_get_default();
DISABLE_HEAP_LEAK_CHECK;
pango_font_map_list_families(font_map, families, n_families);
}
Expand Down Expand Up @@ -210,7 +202,7 @@ bool PangoFontInfo::ParseFontDescriptionName(const std::string& name) {
// correspond to a completely different font family and face.
PangoFont* PangoFontInfo::ToPangoFont() const {
SoftInitFontConfig();
PangoFontMap* font_map = PangoFontInfo::get_font_map();
PangoFontMap* font_map = pango_cairo_font_map_get_default();
PangoContext* context = pango_context_new();
pango_cairo_context_set_resolution(context, resolution_);
pango_context_set_font_map(context, font_map);
Expand Down Expand Up @@ -367,7 +359,7 @@ bool PangoFontInfo::CanRenderString(const char* utf8_word, int len,
// when there is an illegal grapheme sequence.
const char32 kDottedCircleGlyph = 9676;
bool bad_glyph = false;
PangoFontMap* font_map = PangoFontInfo::get_font_map();
PangoFontMap* font_map = pango_cairo_font_map_get_default();
PangoContext* context = pango_context_new();
pango_context_set_font_map(context, font_map);
PangoLayout* layout;
Expand Down Expand Up @@ -491,7 +483,7 @@ bool FontUtils::IsAvailableFont(const char* input_query_desc,
PangoFont* selected_font = nullptr;
{
PangoFontInfo::SoftInitFontConfig();
PangoFontMap* font_map = PangoFontInfo::get_font_map();
PangoFontMap* font_map = pango_cairo_font_map_get_default();
PangoContext* context = pango_context_new();
pango_context_set_font_map(context, font_map);
{
Expand Down
1 change: 0 additions & 1 deletion src/training/pango_font_info.h
Expand Up @@ -94,7 +94,6 @@ class PangoFontInfo {
// environment variable and creating a fonts.conf file that points to the
// FLAGS_fonts_dir and the cache to FLAGS_fontconfig_tmpdir.
static void SoftInitFontConfig();
static PangoFontMap* get_font_map();
// Re-initializes font config, whether or not already initialized.
// If already initialized, any existing cache is deleted, just to be sure.
static void HardInitFontConfig(const std::string& fonts_dir,
Expand Down

0 comments on commit 1b2bda6

Please sign in to comment.