Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. joeisdead
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    joeisdead

    @joeisdead

    0
    Reputation
    1
    Posts
    2
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    joeisdead Follow

    Best posts made by joeisdead

    This user hasn't posted anything yet.

    Latest posts made by joeisdead

    • Batch font glyphs as images

      I came across this site, which uses machine learning to generate a typeface.

      In the method, they mention that

      A styleGAN model was trained in RunwayML on a dataset of 2674 Google fonts organised as individual image-per-glyph in Drawbot.

      I was able to find a script that generates images from a single font file, but I need it to be able to handle several thousand. The code is here:

      # use absolute or relative path. This can be OTF or TTF.
      font_path = 'my_font.otf'
      # set the current font to be the one specified above, so we can list its glyph names:
      font(font_path)
      # loop through the list of glyph names:
      for gid, g_name in enumerate(listFontGlyphNames()):
          # the new page is 1000 by 1000 points by default
          newPage()
          fs = FormattedString(
              font=font_path,
              fontSize=500,
              align='center',
              )
          # writing the glyph name into the formatted string
          fs.appendGlyph(g_name)
          # a text box in which the string is used
          textBox(fs, (0, 0, 1000, 800))
          # using the GID for the file name, because macOS is not case sensitive:
          saveImage(f'~/Desktop/{gid}_{g_name}.png')
      

      Could someone please advise me on how I could achieve this? I already have a large folder of ttf files ready to be converted.

      Thanks in advance!!

      posted in General Discussion
      joeisdead
      joeisdead