Contributed by goddesse https://bbs.archlinux.org/viewtopic.php?pid=864901#p864901 diff -Naur freetype-2.4.4/src/base/ftlcdfil.c freetype-2.4.4.new/src/base/ftlcdfil.c --- freetype-2.4.4/src/base/ftlcdfil.c 2010-12-12 12:05:21.606671258 -0600 +++ freetype-2.4.4.new/src/base/ftlcdfil.c 2010-12-12 12:08:17.726671242 -0600 @@ -180,14 +180,17 @@ else if (strcasecmp(alignment_type_env, "infinality1") == 0) alignment_type = 6; else alignment_type = 0; - if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular") - || strstr(slot.metrics->root.scaler.face->style_name, "Book") - || strstr(slot.metrics->root.scaler.face->style_name, "Medium") - ||*/ strcasestr(slot->face->style_name, "Italic") - || strcasestr(slot->face->style_name, "Oblique") ) - alignment_type = 0; - if ( strcasestr(slot->face->style_name, "Bold") ) - alignment_type = 0; + if ( slot->face != NULL && slot->face->style_name != NULL ) + { + if ( /*strstr(slot.metrics->root.scaler.face->style_name, "Regular") + || strstr(slot.metrics->root.scaler.face->style_name, "Book") + || strstr(slot.metrics->root.scaler.face->style_name, "Medium") + ||*/ strcasestr(slot->face->style_name, "Italic") + || strcasestr(slot->face->style_name, "Oblique") ) + alignment_type = 0; + if ( strcasestr(slot->face->style_name, "Bold") ) + alignment_type = 0; + } } checked_alignment_type = 1; } @@ -214,16 +217,19 @@ /*printf("%s,%s ", slot->face->family_name, slot->face->style_name);*/ /*printf("%d ", slot->face->size->metrics.x_ppem);*/ - /* set gamma value to 1 if out of range */ - if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt ) + if ( slot->face && slot->face->size ) { - pseudo_gamma_value = 1; - } + /* set gamma value to 1 if out of range */ + if ( slot->face->size->metrics.x_ppem >= pseudo_gamma_lt ) + { + pseudo_gamma_value = 1; + } - /* don't do alignment for < 10 */ - if ( slot->face->size->metrics.x_ppem < 10 ) - { - alignment_type = 0; + /* don't do alignment for < 10 */ + if ( slot->face->size->metrics.x_ppem < 10 ) + { + alignment_type = 0; + } } if ( mode == FT_RENDER_MODE_LCD ) @@ -642,7 +648,9 @@ if ( pseudo_gamma_value != 1 ) { FT_Byte* line = bitmap->buffer; - float ppem = (float)slot->face->size->metrics.x_ppem; + float ppem = 0; + if ( slot->face && slot->face->size ) + ppem = (float)slot->face->size->metrics.x_ppem; if (ppem >= 5 ) for (height = (FT_UInt)bitmap->rows; height > 0; height--, line += bitmap->pitch )