r21853 by jghali - #14699: Font Bucephalus is not rendered properly

scribus-commit scribus-commit at lists.scribus.net
Sat Mar 25 14:58:13 UTC 2017


Author: jghali
Date: Sat Mar 25 14:58:13 2017
New Revision: 21853

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21853
Log:
#14699: Font Bucephalus is not rendered properly

Modified:
    trunk/Scribus/scribus/fonts/scface.cpp

Modified: trunk/Scribus/scribus/fonts/scface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21853&path=/trunk/Scribus/scribus/fonts/scface.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface.cpp	(original)
+++ trunk/Scribus/scribus/fonts/scface.cpp	Sat Mar 25 14:58:13 2017
@@ -77,24 +77,33 @@
 {
 	if (!m_hbFont)
 	{
-		if (!ftFace())
+		FT_Face face = ftFace();
+		if (!face)
 			return NULL;
 
-		if (formatCode == ScFace::SFNT || formatCode == ScFace::TTCF || formatCode == ScFace::TYPE42)
+		// #14699: Harfbuzz internal functions apparently do not support font with a single Apple Roman CMap
+		// Force use of FreeType function in such case
+		if ((face->num_charmaps == 1) && (face->charmaps[0]->encoding == FT_ENCODING_APPLE_ROMAN))
+		{
+			m_hbFont = hb_ft_font_create_referenced(face);
+		}
+
+		if (!m_hbFont && (formatCode == ScFace::SFNT || formatCode == ScFace::TTCF || formatCode == ScFace::TYPE42))
 		{
 			// use HarfBuzz internal font functions for formats it supports,
 			// gives us more consistent glyph metrics.
-			FT_Reference_Face(ftFace());
-			hb_face_t *hbFace = hb_face_create_for_tables(referenceTable, ftFace(), (hb_destroy_func_t) FT_Done_Face);
-			hb_face_set_index(hbFace, ftFace()->face_index);
-			hb_face_set_upem(hbFace, ftFace()->units_per_EM);
+			FT_Reference_Face(face);
+			hb_face_t *hbFace = hb_face_create_for_tables(referenceTable, face, (hb_destroy_func_t) FT_Done_Face);
+			hb_face_set_index(hbFace, face->face_index);
+			hb_face_set_upem(hbFace, face->units_per_EM);
 
 			m_hbFont = hb_font_create(hbFace);
 			hb_ot_font_set_funcs(reinterpret_cast<hb_font_t*>(m_hbFont));
 
 			hb_face_destroy(hbFace);
 		}
-		else
+		
+		if (!m_hbFont)
 		{
 			m_hbFont = hb_ft_font_create_referenced(ftFace());
 		}




More information about the scribus-commit mailing list