Ad by artcity

Forum

 

9 posts

BDF Font: how to reduce height?

Jul 02, 2013 at 20:03

Hello everyone,

I know very little about font editing, as I only download free fonts and once a while I fix them by using FontForge.

I've downloaded a font in Windows FON format which I liked and I converted it to BDF to use it on Linux. However, its line spacing is too wide, and I'd like to reduce it by 4 pixels. How can I reduce the height of a BDF font? AFAIK, FontForge only allows you to set the width of a font.

Moreover, the letters are off-center vertically: I should move them 3 pixels towards the top, but this is not necessary.

I've opened the BDF file with a text editor to look for properties to change. However, it seems to me that there is redundancy among properties, hence I suppose you have to propagate each change carefully. In case any user here is knowledgeable about the BDF format, I've attached the lines that seem relevant to my objective. However, I hope there are free tools out there to accomplish this goal.

Here are the relevant lines from the BDF header section (my comments are preceded by //):

SIZE 15 100 100
FONTBOUNDINGBOX 8 16 0 -5 // <- This should become 8 12 0 -5 (cut 4 pixels), right?
STARTPROPERTIES 33
PIXEL_SIZE 21 // <- This should become 17 (cut 4 pixels), right?
POINT_SIZE 150
RESOLUTION_X 100
RESOLUTION_Y 100
SPACING "M"
AVERAGE_WIDTH 80
FONT_ASCENT 17 // <- This should become 13 (cut 4 pixels), right?
FONT_DESCENT 4
UNDERLINE_POSITION -2
UNDERLINE_THICKNESS 2
X_HEIGHT 5
CAP_HEIGHT 8
RAW_ASCENT 800
RAW_DESCENT 200
NORM_SPACE 8
RELATIVE_WEIGHT 40
RELATIVE_SETWIDTH 50
FIGURE_WIDTH 8
AVG_LOWERCASE_WIDTH 80
AVG_UPPERCASE_WIDTH 80
ENDPROPERTIES

Then each letter has the following format and I suppose that I should edit the BBOX property:

STARTCHAR uni0001
ENCODING 1
SWIDTH 381 0
DWIDTH 8 0
BBX 8 10 0 -2 // <- This should become BBX 8 6 0 -2 (cut 4 pixels)
BITMAP
[... bitmap data ...]
ENDCHAR

Any help? Thanks in advance.


Jul 02, 2013 at 20:14

You would need to alter the vertical metrics, to change the height of the glyphs. I don't know if you can do that with FontForge. It's not really something that should be encouraged, either. Instead of modifying someone else' work to suit your purposes, you really ought to make your own fonts. That way, the height, spacing, centering, etc. will be exactly the way you want them to be, or as close as you can get, with your skill level.


Jul 02, 2013 at 21:04

You can not change the height of the glyphs with the vertical metrics. With the vertical metrics you can only change the space above and under the characters, acsender/decsender/line gap.
Apart from that, as said by a wise owl, you should not modify other people's work, you should respect it. If a font does not fit your needs find another one or ask the designer for a modified version. Or make one yourself. That simple.


Jul 02, 2013 at 21:36

Thank you for your replies.

@koeiekat
I only download and customize fonts under a free license, for personal use. Of course, If I were to publish them, I would let the author know. I don't like to bother free software authors when I can work around issues. Moreover, in this case, the author has published only a FON file, therefore I assume that he works on Windows and he wouldn't know how to build fonts for Linux.

"With the vertical metrics you can only change the space above and under the characters, acsender/decsender/line gap."

That's exactly what I'd like to do: I don't want to change the glyphs. Only, there is too much blank space on top of the fonts that I'd like to remove. That's it.

Is there any free tool on Linux, besides FontForge, that would allow me to make such changes? If not, how should I edit the BDF file to achieve my goal (of course, I wouldn't do it by hand, but I'd use a script)?

Thanks.

Edited on Jul 02, 2013 at 21:40 by egarrulo


Jul 02, 2013 at 21:54

koeiekat said  
You can not change the height of the glyphs with the vertical metrics...

Yes, it can be done, but perhaps not with FontCreator. It CAN be done with FontLab Studio5. The procedure involves making two separate changes the the UPM size, and also some changes to the True Type specific metrics.

Toto@K22 sent me a tutorial on how to do it, as I had expressed interest in creating a conventional sized version of my current font project. I've tested his method, and it works. That's the sort of thing I would do as the very last step before completing the font, because while editing, the larger size of glyphs that I use is a decided advantage.


Jul 02, 2013 at 22:28

Nope. To change the height of the glyphs you would need to scale the height to a percentage under 100% while maintaining the width of the glyphs to 100% which causes a deformation of the glyphs. Changing the units per em leads to the same effect as scaling maintaining aspect ratio. Both these, of course, require correction of the metrics and if you have not done it carefully not only the vertical metrics but also the horizontal, the advance widths.
For what the OP wants the solution lies in changing the vertical metrics so that the white space above and under the glyphs is the same:

QUOTE
However, its line spacing is too wide, and I'd like to reduce it by 4 pixels. How can I reduce the height of a BDF font? AFAIK, FontForge only allows you to set the width of a font.
Moreover, the letters are off-center vertically: I should move them 3 pixels towards the top, but this is not necessary.
UNQUOTE.

OP's problem is, he talks in px instead of em. Other OP problem is Linux and a shitty Linux application.


Jul 02, 2013 at 22:35

@metaphasebrothel: BDF font is bitmap font.



Jul 02, 2013 at 23:59

claudeserieux said  
BDF font is bitmap font.

This.

koeiekat said  
Other OP problem is Linux and a shitty Linux application.

Well, I could run a Windows application on Linux, if needed.

I've tried reading the BDF specification, but I couldn't figure out what I was supposed to do.


Jul 03, 2013 at 00:18

Meanwhile I've found a TTF version of the font I was trying to fix, and the TTF version doesn't have extra line spacing. Therefore, my original problem is solved. Still, I would like to know how I could have solved the problem, just in case. If I ever decide to customize the font, then I only know how to edit bitmap fonts.

Thanks again for your attention, guys.



All times are CEST. The time is now 14:02


 
Privacy Policy  -  Contact