diff --git a/doc/ft_encodings.rst b/doc/ft_encodings.rst index fc53e308..6e9ea795 100644 --- a/doc/ft_encodings.rst +++ b/doc/ft_encodings.rst @@ -29,7 +29,7 @@ the FT_Select_Charmap API function. 'http://langsupport.japanreference.com/encoding.shtml'. See note on multi-byte encodings below. -.. data:: FT_ENCODING_GB2312 +.. data:: FT_ENCODING_PRC Corresponds to an encoding system for Simplified Chinese as used used in mainland China. diff --git a/doc/tt_ms_ids.rst b/doc/tt_ms_ids.rst index ede063c6..b3065c36 100644 --- a/doc/tt_ms_ids.rst +++ b/doc/tt_ms_ids.rst @@ -21,10 +21,10 @@ charmaps and name entries. Corresponds to SJIS Japanese encoding. See FT_ENCODING_SJIS. -.. data:: TT_MS_ID_GB2312 +.. data:: TT_MS_ID_PRC Corresponds to Simplified Chinese as used in Mainland China. See - FT_ENCODING_GB2312. + FT_ENCODING_PRC. .. data:: TT_MS_ID_BIG_5 diff --git a/examples/font-info.py b/examples/font-info.py index d362f875..73739167 100644 --- a/examples/font-info.py +++ b/examples/font-info.py @@ -17,13 +17,14 @@ face = Face(sys.argv[1]) - print ('Family name: {}'.format(face.family_name)) - print ('Style name: {}'.format(face.style_name)) + print ('Family name: {}'.format(face.family_name.decode("ascii", errors='ignore'))) + print ('Style name: {}'.format(face.style_name.decode("ascii", errors='ignore'))) print ('Charmaps: {}'.format([charmap.encoding_name for charmap in face.charmaps])) print ('') print ('Face number: {}'.format(face.num_faces)) print ('Glyph number: {}'.format(face.num_glyphs)) - print ('Available sizes: {}'.format(face.available_sizes)) + # FT_Bitmap_Size.size is in F26.6. Need to divide by 64: + print ('Available sizes: {}'.format([bitmap_size.size/64 for bitmap_size in face.available_sizes])) print ('') print ('units per em: {}'.format(face.units_per_EM)) print ('ascender: {}'.format(face.ascender)) diff --git a/examples/ftdump.py b/examples/ftdump.py index b676d099..09137995 100644 --- a/examples/ftdump.py +++ b/examples/ftdump.py @@ -29,10 +29,10 @@ def usage( execname ): def Print_Name( face ): print( "font name entries" ); - print( " family: %s" % face.family_name ) - print( " style: %s" % face.style_name ) + print( " family: %s" % face.family_name.decode("ascii", errors='ignore') ) + print( " style: %s" % face.style_name.decode("ascii", errors='ignore') ) ps_name = face.postscript_name or "UNAVAILABLE" - print( " postscript: %s" % ps_name ) + print( " postscript: %s" % ps_name.decode("ascii", errors='ignore') ) def Print_Type( face ): @@ -214,11 +214,11 @@ def Print_Fixed( face ): # available size for i,bsize in enumerate(face.available_sizes): - print( " %3d: height %d, width %d\n", - i, bsize.height, bsize.width ) - print( " size %.3f, x_ppem %.3f, y_ppem %.3f\n", - bsize.size / 64.0, - bsize.x_ppem / 64.0, bsize.y_ppem / 64.0 ) + print( " %3d: height %d, width %d" % + ( i, bsize.height, bsize.width ) ) + print( " size %.3f, x_ppem %.3f, y_ppem %.3f" % + ( bsize.size / 64.0, + bsize.x_ppem / 64.0, bsize.y_ppem / 64.0 ) ) def Print_Charmaps( face ): diff --git a/freetype/ft_enums/ft_encodings.py b/freetype/ft_enums/ft_encodings.py index 50f38de4..566bc375 100644 --- a/freetype/ft_enums/ft_encodings.py +++ b/freetype/ft_enums/ft_encodings.py @@ -34,10 +34,11 @@ 'http://langsupport.japanreference.com/encoding.shtml'. See note on multi-byte encodings below. -FT_ENCODING_GB2312 +FT_ENCODING_PRC - Corresponds to an encoding system for Simplified Chinese as used used in - mainland China. + Corresponds to encoding systems mainly for Simplified Chinese as + used in People's Republic of China (PRC). The encoding layout + is based on GB~2312 and its supersets GBK and GB~18030. FT_ENCODING_BIG5 @@ -94,7 +95,7 @@ def _FT_ENC_TAG(a,b,c,d): 'FT_ENCODING_MS_SYMBOL' : _FT_ENC_TAG( 's','y','m','b' ), 'FT_ENCODING_UNICODE' : _FT_ENC_TAG( 'u','n','i','c' ), 'FT_ENCODING_SJIS' : _FT_ENC_TAG( 's','j','i','s' ), - 'FT_ENCODING_GB2312' : _FT_ENC_TAG( 'g','b',' ',' ' ), + 'FT_ENCODING_PRC' : _FT_ENC_TAG( 'g','b',' ',' ' ), 'FT_ENCODING_BIG5' : _FT_ENC_TAG( 'b','i','g','5' ), 'FT_ENCODING_WANSUNG' : _FT_ENC_TAG( 'w','a','n','s' ), 'FT_ENCODING_JOHAB' : _FT_ENC_TAG( 'j','o','h','a' ), diff --git a/freetype/ft_enums/tt_ms_ids.py b/freetype/ft_enums/tt_ms_ids.py index 57027bb9..fa8daf71 100644 --- a/freetype/ft_enums/tt_ms_ids.py +++ b/freetype/ft_enums/tt_ms_ids.py @@ -26,10 +26,11 @@ Corresponds to SJIS Japanese encoding. See FT_ENCODING_SJIS. -TT_MS_ID_GB2312 +TT_MS_ID_PRC - Corresponds to Simplified Chinese as used in Mainland China. See - FT_ENCODING_GB2312. + Chinese encodings as used in the People's Republic of China (PRC). + This means the encodings GB~2312 and its supersets GBK and + GB~18030. See FT_ENCODING_PRC. TT_MS_ID_BIG_5 @@ -57,7 +58,7 @@ 'TT_MS_ID_SYMBOL_CS' : 0, 'TT_MS_ID_UNICODE_CS' : 1, 'TT_MS_ID_SJIS' : 2, - 'TT_MS_ID_GB2312' : 3, + 'TT_MS_ID_PRC' : 3, 'TT_MS_ID_BIG_5' : 4, 'TT_MS_ID_WANSUNG' : 5, 'TT_MS_ID_JOHAB' : 6,