| 1 |
from __future__ import print_function |
| 2 |
__license__ = """ |
| 3 |
This file is part of GNU FreeFont. |
| 4 |
|
| 5 |
GNU FreeFont is free software: you can redistribute it and/or modify it under |
| 6 |
the terms of the GNU General Public License as published by the Free Software |
| 7 |
Foundation, either version 3 of the License, or (at your option) any later |
| 8 |
version. |
| 9 |
|
| 10 |
GNU FreeFont is distributed in the hope that it will be useful, but WITHOUT |
| 11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License along with |
| 15 |
GNU FreeFont. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
""" |
| 17 |
__author__ = "Stevan White" |
| 18 |
__email__ = "[email protected]" |
| 19 |
__copyright__ = "Copyright 2015, 2018 Stevan White" |
| 20 |
__date__ = "$Date:: 2020-11-18 00:40:52 +0100#$" |
| 21 |
__version__ = "$Revision: 4248 $" |
| 22 |
|
| 23 |
__doc__ = """ |
| 24 |
For use from the FontForge Script Menu. |
| 25 |
Add it to the Scripts Menu using the Preferences dialog. |
| 26 |
|
| 27 |
Sets the OpenType glyph class of the selected range of slots to 'baseligature' |
| 28 |
|
| 29 |
Detailed info is printed to standard output (see by launching FontForge |
| 30 |
from a console). |
| 31 |
""" |
| 32 |
import fontforge |
| 33 |
|
| 34 |
def explain_error_and_quit( e ): |
| 35 |
if e: |
| 36 |
print( 'Error:', e ) |
| 37 |
exit( 1 ) |
| 38 |
|
| 39 |
try: |
| 40 |
glyphs = fontforge.activeFont().selection.byGlyphs |
| 41 |
for g in glyphs: |
| 42 |
print( "setting", g.glyphname, 'glyph class to', 'baseligature' ) |
| 43 |
g.glyphclass = 'baseligature' |
| 44 |
except ValueError as e: |
| 45 |
explain_error_and_quit( e ) |
| 46 |
|