The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Remove regular form full name for the regular style

These changes was commited to the Birdfont repository Sat, 17 Oct 2015 13:43:38 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Sat, 17 Oct 2015 13:43:38 +0000]

Updated Files

libbirdfont/OpenFontFormat/NameTable.vala
--- a/libbirdfont/OpenFontFormat/NameTable.vala +++ b/libbirdfont/OpenFontFormat/NameTable.vala @@ -148,7 +148,18 @@ public string validate_name (string s) { return name_validation (s, true); } + + public string validate_full_name (string s) { + string n = name_validation (s, true); + string regular_suffix = " Regular"; + if (n.has_suffix (regular_suffix)) { + n = n.substring (0, n.length - regular_suffix.length); + } + + return n; + } + public static string name_validation (string s, bool allow_space, int max_length = 27) { @@ -157,7 +168,7 @@ unichar c; StringBuilder name = new StringBuilder (); - n = s; + n = s.strip (); ccount = n.char_count (); // truncate strings longer than 28 characters for (int i = 0; i < ccount && i < max_length; i++) { @@ -233,7 +244,7 @@ text.add (validate_name (font.unique_identifier)); type.add (UNIQUE_IDENTIFIER); - text.add (validate_name (font.full_name)); + text.add (validate_full_name (font.full_name)); type.add (FULL_FONT_NAME); text.add (font.version); @@ -242,13 +253,13 @@ text.add (validate_ps_name (font.postscript_name)); type.add (POSTSCRIPT_NAME); - text.add (validate_ps_name (font.trademark)); + text.add (font.trademark); type.add (TRADE_MARK); - text.add (validate_ps_name (font.manufacturer)); + text.add (font.manufacturer); type.add (MANUFACTURER); - text.add (validate_ps_name (font.designer)); + text.add (font.designer); type.add (DESIGNER); text.add (font.description);