3333print ("Style name: " , font .style_name ) # face style name
3434print ("PS name: " , font .postscript_name ) # the postscript name
3535print ("Num fixed: " , font .num_fixed_sizes ) # number of embedded bitmaps
36- print ("Bbox: " , font .bbox ) # the face global bounding box (xmin, ymin, xmax, ymax)
37- print ("EM: " , font .units_per_EM ) # number of font units covered by the EM
36+ print ("Bbox: " , font .bbox ) # global bounding box (xmin, ymin, xmax, ymax)
37+ print ("EM: " , font .units_per_EM ) # font units per EM
3838print ("Ascender: " , font .ascender ) # the ascender in 26.6 units
3939print ("Descender: " , font .descender ) # the descender in 26.6 units
4040print ("Height: " , font .height ) # the height in 26.6 units
41- print ("Max adv width: " , font .max_advance_width ) # maximum horizontal cursor advance
41+ print ("Max adv width: " , font .max_advance_width ) # max horizontal advance
4242print ("Max adv height: " , font .max_advance_height ) # same for vertical layout
43- print ("Underline pos: " , font .underline_position ) # vertical position of the underline bar
44- print ("Underline thickness:" , font .underline_thickness ) # vertical thickness of the underline
43+ print ("Underline pos: " , font .underline_position ) # underline bar position
44+ print ("Underline thickness:" , font .underline_thickness ) # underline thickness
4545
4646for flag in ft .StyleFlags :
4747 name = flag .name .replace ('_' , ' ' ).title () + ':'
5353
5454# Normalise all vertical metrics to units_per_EM so all y-values sit in [-1, 1].
5555u = font .units_per_EM
56- asc = font .ascender / u
57- desc = font .descender / u
56+ asc = font .ascender / u
57+ desc = font .descender / u
5858bbox_ymax = font .bbox [3 ] / u
5959bbox_ymin = font .bbox [1 ] / u
60- ul_pos = font .underline_position / u
61- ul_thick = font .underline_thickness / u
60+ ul_pos = font .underline_position / u
61+ ul_thick = font .underline_thickness / u
6262
6363fig , ax = plt .subplots (figsize = (8 , 6 ))
6464
7676
7777# Lines, rectangle and labels are all derived from these real glyph bounds.
7878H_MARGIN = 0.05 # horizontal padding around glyph
79- LINE_X0 = glyph_x0 - H_MARGIN # lines start here
80- LINE_X1 = glyph_x1 + H_MARGIN # lines end here (always past glyph edge)
81- LABEL_X = LINE_X1 + 0.08 # metric labels start here
79+ LINE_X0 = glyph_x0 - H_MARGIN # lines start here
80+ LINE_X1 = glyph_x1 + H_MARGIN # lines end here (always past glyph edge)
81+ LABEL_X = LINE_X1 + 0.08 # metric labels start here
8282
8383metrics = [
8484 ("bbox top (ymax)" , bbox_ymax , "tab:green" ),
9393 ax .plot ([LINE_X0 , LINE_X1 ], [y , y ],
9494 color = color , linewidth = 1.5 , linestyle = '--' , alpha = 0.9 , zorder = 2 )
9595 # Nudge bbox-edge labels slightly away from the rectangle border.
96- y_text = (y - 0.015 if "bbox top" in label else
96+ y_text = (y - 0.015 if "bbox top" in label else
9797 y + 0.015 if "bbox bottom" in label else y )
9898 ax .text (LABEL_X , y_text , label ,
9999 color = color , va = 'center' , ha = 'left' ,
131131ax .legend (fontsize = 8 , loc = 'upper right' , bbox_to_anchor = (1.02 , 0.95 ), frameon = False )
132132ax .axis ('off' )
133133plt .tight_layout (pad = 1.5 )
134- plt .show ()
134+ plt .show ()
0 commit comments