You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KBP font sizes are based on cap height (possibly capital X specifically?). That means, if you request font size 12, your capital X will be 12 characters high. Depending on font, some symbols could be substantially larger or smaller, and it makes layout difficult.
ASS font sizes are based on the total height of the font, e.g. the full block character, if it exists in the font face, will have that height. This way it's easier to prevent collisions and such, but the fact that it's different from KBS causes issues.
Current code is scaling the KBP font size by 1.4x, which works well for Arial and fonts with similar metrics, but it can cause issues with weird fonts. Messing around with freetype, I think I can calculate the appropriate scaling factor as follows (example with Arial 12 Bold):
>>>> import freetype
>>> face = freetype.Face('/usr/share/fonts/truetype/arialbd.ttf')
>>> face.load_char('X')
>>> 12 * 2048 / face.glyph.metrics.height
16.763983628922237 # Lines up great with 1.4*kbp_size=16.8
But hopefully there's a way to do this at a higher level than freetype because just locating all the font files by name would be difficult.
The text was updated successfully, but these errors were encountered:
KBP font sizes are based on cap height (possibly capital X specifically?). That means, if you request font size 12, your capital X will be 12 characters high. Depending on font, some symbols could be substantially larger or smaller, and it makes layout difficult.
ASS font sizes are based on the total height of the font, e.g. the full block character, if it exists in the font face, will have that height. This way it's easier to prevent collisions and such, but the fact that it's different from KBS causes issues.
Current code is scaling the KBP font size by 1.4x, which works well for Arial and fonts with similar metrics, but it can cause issues with weird fonts. Messing around with freetype, I think I can calculate the appropriate scaling factor as follows (example with Arial 12 Bold):
But hopefully there's a way to do this at a higher level than freetype because just locating all the font files by name would be difficult.
The text was updated successfully, but these errors were encountered: