fontforge / fontforge

Free (libre) font editor for Windows, Mac OS X and GNU+Linux
http://fontforge.github.io/
Other
6.47k stars 700 forks source link

Add python script to center glyph vertically #2227

Open abdelouahabb opened 9 years ago

abdelouahabb commented 9 years ago

Hi, Thank you for this wonderful software. My problem is I can only select left/right guidlines (from the layers), I try to center this icon in the middle, but the lonly way I have now is to scale down. In previous version, I remember I did that, but not anymore! sans titre

larsenwork commented 9 years ago

I'm not completely sure what you're aiming to achieve from your description. You can set the width and center the glyph using the metrics menu screen shot 2015-04-28 at 00 06 58

davelab6 commented 9 years ago

These are not guides, they are sideBearings :)

abdelouahabb commented 9 years ago

there is center in width but there is no center in height, which is the problem here :(

larsenwork commented 9 years ago

I don't believe that's been a feature i recent times and it's not really something you'd need for fonts. You can always export and edit in the vector editor you have (illustrator, inkscape etc.) - they are better suited for drawing icons anyway and then just import once everything is done. Just remember to use the same size in both programs UPM

abdelouahabb commented 9 years ago

I ended up with scale down the chars, but I am pretty sure I was able to use the upper handler, but dont remember the version...

Edit: @andreaslarsen now I get the problem, this is because I merged two fonts, so the new one became smaller to match the first font.

Thank you :)

larsenwork commented 9 years ago

You're welcome:)

abdelouahabb commented 9 years ago

thank you again for this awesome software :+1:

and please, add the option to change the language without deleting the locales, because the french translation is hell !

davelab6 commented 9 years ago

The vertical metrics are set in a technical way, but it would be possible to write a python script to set glyphs vertically centered with in them.

I agree about the translation stuff. The best I can say is that you can contribute to make it better! :)

larsenwork commented 9 years ago

if/when someone creates such a script it should have an option to center in UPM and between baseline and ascent

larsenwork commented 9 years ago

and helping with translation is as simple as editing this file https://github.com/fontforge/fontforge/blob/master/po/fr.po

abdelouahabb commented 9 years ago

I wish I could, but I have first to find the right word, because it must be from calligraphy domain, which I am not :(

But seriously, I was really lost in the GUI because it was in french (I speak french), but as long as I deleted the po file, I got it clear!

cpitclaudel commented 9 years ago

This file seems to do something of this flavor: https://fontindustry.googlecode.com/files/centerglyph.py

odahcam commented 8 years ago

Nice @cpitclaudel , but I couldn't install this on FF, since I put the file on /python folder I don't know what to do anymore. Seems like my FF didn't recognize the script since the tools menu never changes. Could you help me?

cpitclaudel commented 8 years ago

Should be in the Fonts/Metrics and Fonts/Transform menus.

odahcam commented 8 years ago

In this places? metrics transform

Sorry if I'm being stupid, I'm a newbie in this area...

cpitclaudel commented 8 years ago

In that case I have no idea; I don't use that script. I guessed from this section:


if fontforge.hasUserInterface():
    fontforge.registerMenuItem(GetSelectedBound, None, None, "Font", None,
            "Metrics", "Max Selected Size");
    fontforge.registerMenuItem(CenterHeight, None, None, "Font", None, "Metrics", 
            "Center in Height");
    fontforge.registerMenuItem(CenterGlyph, None, None, "Font", None, "Metrics", 
            "Center in Glyph");
    fontforge.registerMenuItem(ScaleToEm, None, None, "Font", None, "Transform", 
            "Scale to Em");
davelab6 commented 8 years ago

All scripts menu items appear inside the tools menu; this sets up submenus within it

odahcam commented 8 years ago

Yeah, but the code is from 2008 and FF is on a 2015 build. I think there's a conflict of versions...