fog2ufo

Has anyone scripted the conversion of .fog files to .ufo?

Comments

  • Adam TwardochAdam Twardoch Posts: 507
    edited October 2020
    Save this script:
    
    import os.path
    from fontlab import *
    from PythonQt import QtGui
    
    fontFileName = "example.fog"
    fontPath = os.path.join(os.path.dirname(__file__), fontFileName)
    
    ws = flWorkspace.instance()
    main = ws.mainWindow
    main.loadFont(fontPath)
    fp = ws.currentPackage
    pref = flPreferences()
    ec = ExportControl()
    ec.profileName = "UFO Package"
    ec.destinationMode = pref.DestinationFolder
    ec.conflictMode = pref.ConflictOverwrite
    ec.contentMode = pref.ContentCurrent
    ec.destinationFolder = os.path.dirname(fontPath)
    ec.groupProfiles = False
    ec.groupFamily = False
    ws.exportFont(fp, ec)
    qapp = QtGui.QApplication.instance()
    qapp.quit()
    
    as "fog2ufo.vfpy" and run FontLab 7 in commandline with the path to "fog2ufo.vfpy" as commandline argument. Change fontFileName as needed (in this version, it needs to be in the same folder as "fog2ufo.vfpy").
  • Adam TwardochAdam Twardoch Posts: 507
    edited October 2020
    Ps. The code in FontLab 7 for opening .fog files is based on the code that FLS5 had. 
  • The question sounded more like if someone had the spec for .fog files. 
  • The spec would be nice, but for my immediate practical purposes, I just need a scripted build process from .fog to .ttf via fontmake :) Thanks both!
  • I don't think there is such thing as .fog files spec (there are 2 .fog file formats, btw), I think I made parser by checking Fog code + applying it to some sample fog files.
  • Could you share the relevant code?
  • @Adam Twardoch Out of interest, does FL6 use a different method for opening .fog files? I tried opening one recently in it and found everything to be super pixelated and couldn't be edited. FL5 worked fine. 
  • Was it FL6 or FL7? There might be some bug in the FL7 code. I checked some .fog files and they worked fine, including fractional coordinates etch FOG & FL7 support but FLS5 does not.

    It'd help if you could share the failing font via https://support.fontlab.com/ so we can see what's going on. 

    .fog format also supports embedded bitmaps, maybe they're interfering.
  • Ahh. It is the embedded bitmaps that are indeed interfering. Is there a way to disable FL6 from loading them?
Sign In or Register to comment.