CMM2: Font height?


Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6207
Posted: 01:48am 01 Aug 2020      

  mkopack73 said  Is there any way to query the height of a given font (assuming that it might not be one of the built in ones).
Thoughts?


The first group of data in a font file gives you the sizes.
the order of info is character count, character start, character height, character width,
This font
DefineFont #8
 01203C30
 00000000 00000000 00002000 F8010000 00000000 0080FF3F FFE30000 010000C0
 00E07FC9 01900300 060000F0 00F80080 00000F00 1E0000FC 007E0000 20001E00
 3C00003E 000F7900 FF0B3C00 7800800F C007FF03 FF0B7800 7800C087 C083FF3F
 3F3FF800 F800E0C3 E063FFFF FF7FF800 F004E0E7 E0FFFFFF FFCB710F E30FE0FF
 E0FF1FC0 0F84E70F E30BE0F1 E0C0CF9F 67D1E30B 430BE018 608E07C0 C3FFC30A
 C100E003 E08983CF 83FFC1F8 41FAE09F E0CFC3FF 83CFB1FB 90FBC0FF C0FFC30F
 071F10FF 90FFC0BF C09F071E 071C36FE 7200C0CF C0C7013D 817F3300 3F00C0E7
 80FBD0FF FDFF77FC 475C80FF 80DF3FF0 0070735C 6758000F 007F43F8 7AF87348
 3BF1007F 00FEF5FA 7FFEF900 3DF800FE 00FC3FBE 03FE0DFF C6FF00F8 00F84FFF
 6F3FF1A7 F84700F0 00E0FF7F FF3FDE1F FF0700C0 0080FF3F FF8FFED3 FEFD0000
 00003F40 3E60FAFF BACF0000 00003C74 1CAEFEFF F6DF0000 00003C3F 9C3FF8FF
 FEFF0000 0000FC4F 00000000
End DefineFont


has 01203C30 which can be expanded using
cc = val("&h"+mid$(txt$,1,2)) ' character count
cs = val("&h"+mid$(txt$,3,2)) ' character start
ch = val("&h"+mid$(txt$,5,2)) ' character height
cw = val("&h"+mid$(txt$,7,2)) ' character width


to
1 character, Chr$(32), 60 pixels high and 48 pixels wide

Jim