| 1 |
__license__ = """ |
| 2 |
This file is part of GNU FreeFont. |
| 3 |
|
| 4 |
GNU FreeFont is free software: you can redistribute it and/or modify it under |
| 5 |
the terms of the GNU General Public License as published by the Free Software |
| 6 |
Foundation, either version 3 of the License, or (at your option) any later |
| 7 |
version. |
| 8 |
|
| 9 |
GNU FreeFont is distributed in the hope that it will be useful, but WITHOUT |
| 10 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU General Public License along with |
| 14 |
GNU FreeFont. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
""" |
| 16 |
__author__ = "Stevan White" |
| 17 |
__email__ = "[email protected]" |
| 18 |
__copyright__ = "Copyright 2011, 2012, 2018 Stevan White" |
| 19 |
__date__ = "$Date:: 2018-06-03 21:57:09 +0200#$" |
| 20 |
__version__ = "$Revision: 3914 $" |
| 21 |
__doc__ = """ |
| 22 |
Common tools used by the generate scripts. |
| 23 |
""" |
| 24 |
|
| 25 |
import re |
| 26 |
|
| 27 |
_re_vstr = re.compile( '\$Revision: (\d*)\s*\$(.*)' ) |
| 28 |
|
| 29 |
def trim_version_str( font ): |
| 30 |
""" SVN automatically puts a revision number between dollar signs |
| 31 |
in the sfd file's Version string. |
| 32 |
However the OpenType standard recommends |
| 33 |
Version n.m |
| 34 |
Where n and m are decimal numbers. |
| 35 |
""" |
| 36 |
vstr_match = _re_vstr.match( font.version ) |
| 37 |
otstdized = '' |
| 38 |
if vstr_match: |
| 39 |
trimmed = vstr_match.group( 1 ) |
| 40 |
rest = vstr_match.group( 2 ) |
| 41 |
otstdized = '0412.' + trimmed + rest |
| 42 |
font.version = otstdized |
| 43 |
#font.appendSFNTName( n[0], n[1], otstdized ) |
| 44 |
return trimmed |
| 45 |
return otstdized |
| 46 |
|