Blame tools/apply_gsub_rules.py

Packit 7179fe
#!/usr/bin/python
Packit 7179fe
Packit 7179fe
# Copyright (C) 2012, Aravinda VK <hallimanearavind@gmail.com>
Packit 7179fe
#                          http://aravindavk.in
Packit 7179fe
Packit 7179fe
# This program is free software: you can redistribute it and/or modify
Packit 7179fe
# it under the terms of the GNU General Public License as published by
Packit 7179fe
# the Free Software Foundation, either version 3 of the License, or
Packit 7179fe
# (at your option) any later version.
Packit 7179fe
Packit 7179fe
# This program is distributed in the hope that it will be useful,
Packit 7179fe
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7179fe
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Packit 7179fe
# GNU General Public License for more details.
Packit 7179fe
Packit 7179fe
# You should have received a copy of the GNU General Public License
Packit 7179fe
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Packit 7179fe
Packit 7179fe
import sys
Packit 7179fe
import fontforge
Packit 7179fe
Packit 7179fe
if __name__ == "__main__":
Packit 7179fe
    font = fontforge.open("../Gubbi.sfd")
Packit 7179fe
    
Packit 7179fe
    # Remove all GSUB lookups
Packit 7179fe
    for lookup in font.gsub_lookups:
Packit 7179fe
        font.removeLookup(lookup)
Packit 7179fe
        
Packit 7179fe
    # Merge the new featurefile 
Packit 7179fe
    font.mergeFeature("gsub.fea")
Packit 7179fe
    font.save()
Packit 7179fe
    font.close()