Skip to content

Improve error messages in sfd.c  #4339

Open

Description

@swapnilkadam950

Hi,

I have been trying to convert .SFD file to .TTF using Font Forge.

I recieve the below error when i import the .SFD file in FontForge.

It says "Couldnot Launch FontForge (Exit Code1)

Operating System : Windows 10

Font Forge Version 2020-03-14

I'm basically trying to convert the .SFD to .TTF

Attached is the screenshot and the .SFD file which im trying to convert it into TTF using FontForge
FontForge Error

Leroy.zip

Can you please help?

Activity

  1. jtanx commented on May 18, 2020

    @jtanx
    Contributor

    It's exiting here

    fontforge/fontforge/sfd.c

    Lines 8926 to 8931 in f076900

    } else if ( strmatch(tok,"BeginChars:")==0 ) {
    int charcnt;
    getint(sfd,&charcnt);
    if (charcnt<enc->char_cnt) {
    IError("SFD file specifies too few slots for its encoding.\n" );
    exit( 1 );

    Kind of crap we just exit instead of throwing an error. How did you generate/get the SFD? You can work around the issue by changing Encoding: AdobeStandard in the sfd to Encoding: Custom, then reencoding to your desired encoding once open in FontForge.

  2. swapnilkadam950 commented on May 18, 2020

    @swapnilkadam950
    Author

    Hi there,

    I created the SFD using the Font Factory application.

    Do you know how do i change the encoding?Can you please advise me the steps as well?

    I very new to Font Forge and Font Conversions too.

    Here is the entire UseCase:
    I need to convert a font available in an engineering tool called Unigraphics to TTF.The extension of the font available in the application is .fnx. I used font factory to create the .sfd

  3. jtanx commented on May 18, 2020

    @jtanx
    Contributor

    Font Factory application.

    Well it's apparently generating invalid SFDs. Do you have a link to the software? Never heard of this one myself.

    Do you know how do i change the encoding

    Open the SFD in a text editor and change it, as I mentioned in my previous post. You'll then need to change it in FontForge, once you can open it (Encoding->Reencode->Unicode BMP)

  4. swapnilkadam950 commented on May 18, 2020

    @swapnilkadam950
    Author

    Hi ,

    You can find the Font Factory Application here :

    https://community.sw.siemens.com/s/question/0D54O000061xSkx/fontfactory-30-now-available

    I followed the steps,If you open the above link ,there is a PDF present explaining how do i convert .fnx to .TTF.
    I should Open Font Forge>Element>Expand Stroke Command.

    Unfortunately the Expand Stroke Command seems to be graded out.

    Do you know how to enable it?

  5. skef commented on May 18, 2020

    @skef
    Contributor

    If you're in the FontView (where each glyph is displayed in a scrolling list) you need to select the glyphs to run Expand Stroke on. Clicking on one will select it, shift-clicking selects additional glyphs, Control-A will select all glyphs.

  6. swapnilkadam950 commented on May 19, 2020

    @swapnilkadam950
    Author

    Hi,

    Thank you for the steps.

    Also you mentioned it is generating invalid SFDs. Do you know how to correct them or do u suggest any other tool to convert .fnx to .sfd

  7. skef commented on May 19, 2020

    @skef
    Contributor

    @swapnilkadam950 It doesn't seem like this Font Factory tool is current/being updated so I'm not sure it's worth pursuing a fix. Assuming the Encoding is the only problem you can just keep hand-editing it or, if you need to bulk-process, write a little search/replace script to do that for you.

    Assuming you know the stroke width and the types of cap and join FontForge can probably do the conversion for you. You might try running it on just one or two glyphs to start with. Expand Stroke is documented here but you probably just need a circular nib of the right stroke with and angle=0.

  8. skef commented on May 19, 2020

    @skef
    Contributor

    I glanced at the PDF. Without examples it's hard to tell exactly what they intend. If you posted a screenshot of a few characters as displayed in FontFactory and also in FontForge just after you've opened the file I might be able to give better advice.

  9. swapnilkadam950 commented on May 19, 2020

    @swapnilkadam950
    Author

    Hi,

    I have attached the Screenshots from FontForge and FontFactory.

    FontForge
    FontFactory

  10. skef commented on May 19, 2020

    @skef
    Contributor

    I can't tell from the display of the font at the bottom of the FontFactory window whether the ends are flat or rounded, but from the style I would guess rounded. So here's what I suggest as a possible procedure:

    1. Open "m" in a CharView window.
    2. Click in the background to make sure there are no selected points.
    3. Open the Element -> Expand Stroke dialog
    4. Set Nib: Circular, Angle: 0, Cap: Round Join: Round. Leave the lower settings as they are.
    5. Set the Width and Height (Major/Minor Axis) each to 30 to start with.
    6. Press "Apply" and move the dialog so you can preview the result in the CharView window
    7. Change the Width and Height until you get the basic result you want.
    8. If bends in the middle of curves look wrong try switching to Miter and then Bevel joins.
    9. If the ends of curves look wrong try switching to Butt caps.
    10. Once you're happy, take note of the top settings in the dialog for future use and press "OK"
    11. If you're still happy with the result, choose Edit -> Undo or type "Control-Z" to undo, then close the CharView window
    12. Back in the FontView type Control-A to select all characters.
    13. Open the FontView Element -> Expand Stroke dialog. The settings should be the same as you left them but if not put them back.
    14. Press "OK" to stroke all selected chars with those settings.
    15. Choose "72 Pixel Outline" from the "View" menu of the FontView window to get a larger preview.
    16. Scroll through all the characters to see if you get the result you wanted.
  11. ctrlcctrlv commented on May 19, 2020

    @ctrlcctrlv
    Member

    We shouldn't be expected to consume third-party SFDs. SFD is not supposed to be that kind of format, and we shouldn't legitimize it becoming one. We should make the error message better and nothing else.

  12. swapnilkadam950 commented on May 21, 2020

    @swapnilkadam950
    Author

    Thank you so much for the steps..I shall try that and update them here..Once i follow those steps i should be able to convert them into a TTF right?

  13. skef commented on May 21, 2020

    @skef
    Contributor

    @swapnilkadam950 Yes -- Once the original contours are stroked and displaying correctly in the FontView you'll be able to "Generate" a TTF.

    Note, however, that there may still be a number of issues that need attention. You may need to adjust the spacing (the space between x=0 and the start of a glyph together with the char width line), although FontFactory may have done that for you. If glyph pairs need kerning you'll have to do that too.

    Still, the shape of the glyphs should be a matter of getting the stroke right.

  14. changed the title [-]Font Forge Crashes with Exit Code 1[/-] [+]Improve error messages in sfd.c [/+] on Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions