TTF file saving using a macro.

Hello, all. I have made a couple of simple fonts using CorelDRAW and saved them manually. Everything worked quite well.

But now there's a need to make something a little bigger and it would REALLY help if there was a way to save, for example, each page to that TTF file (page name could be the character name to be saved).

Best I have managed so far is just looping through the pages, having the proper path predefined and then showing the dialog box where it is necessary to select the correct character.

Sub Macro1()
Dim P As Page
    
Dim expopt As StructExportOptions
    Set expopt = CreateStructExportOptions
    
    Dim expflt As ExportFilter
    
    For Each P In ActiveDocument.Pages
        P.Activate
        
        Set expflt = ActiveDocument.ExportEx("D:\Fonts\Test.ttf", cdrTTF, cdrCurrentPage, expopt)
        expflt.ShowDialog
        expflt.Finish
    Next P
End Sub

Would be great if someone had some input on this. Thanks.

Edit: Also, if someone knows how to properly set character width - so far no matter how I export the TTF character width is 97,6% of the original - it is not squashed, just the whole canvas is slightly cut off. So, if we had characters without any space at the end they will slightly overlap. This is absolutely driving me insane and basically making font creation in CorelDRAW a lost cause.

  • Decided to add some extra information, so this post is not like the hundreds of abandoned questions here.

    I did not find a way to properly export a correct TTF file from CorelDRAW. But since the process is rather annoying anyway, as seen above, another option makes sense. After trying out multiple free font editors Glyphr Studio came out on top - http://www.glyphrstudio.com/

    It is not perfect, but is reasonably pleasant to use with a simple, focused interface. We export our font designs as SVG, then import each letter into Glyphr and a new font is ready. Glyphr has some nice tools to avoid having to set the spacing between characters yourself, etc.

    To ease the process further I made a macro which exports all the shapes on the current page, one by one, as separate SVG files, named by StaticID:

    Sub ExportToSVG()
        Dim FontShape As Shape
        
        Dim expflt As ExportFilter
        
        For Each FontShape In ActivePage.Shapes
            'Select shape so we can export selected
            FontShape.CreateSelection
            
            'Change your path here
            Set expflt = ActiveDocument.ExportEx("C:\Users\joedo\OneDrive\Desktop\" & FontShape.StaticID & ".svg", cdrSVG, cdrSelection)
            With expflt
                .DrawingPrecision = 2 ' FilterSVGLib.svg_1to100
                .UseDecimalPrecision = True
                .Finish
            End With
        Next FontShape
    End Sub
    

    Here it exports to my desktop path - need to change it if you ever want to try it.

    So basically the workflow was:

    1) Create your characters - ideally similarly sized, so it's easier to add spacing, etc.

    2) Export each character as SVG using the macro above (or by hand, if you want). Each character has to be a single shape.

    3) Create a new font in Glyphr. Set it up - name, size (about 800, if you want similar sizing to, say, Arial) and any guides you need. Open the character you want and drag/import the SVG file into it. Do this for all characters.

    4) Export font as OTF and enjoy:

    Obviously using Glyphr needs at least a little learning, but their tutorial gives the basics: https://www.glyphrstudio.com/tutorial/