Dotscreen glyphs into a new font

Dotscreen glyphs from an existing font into another font with a script.

Steps

  1. Open the font you wish to dotscreen.

  2. Open the Scripting Window and paste the script below.

  3. Adjust the values at the top of the script as needed.

  4. If you wish to dotscreen only some glyphs, select them in the Font Overview.
    If the selection is empty, all glyphs in the font will be dotscreened.

  5. Run the script to dotscreen the glyphs into a new font.

Code

# menuTitle: dotscreen selected glyphs into a new font

from hTools3_rasterizer.modules.rasterizer import drawElement
from hTools3_rasterizer.modules.dotscreen import DotScreenGlyph

# --------
# settings
# --------

gridsize = 60
radius   = 25
angle    = 90

# ---------
# dotscreen
# ---------

srcFont = CurrentFont()
dstFont = NewFont(showInterface=False)

dotGlyph = dstFont.newGlyph(DotScreenGlyph.elementGlyph)
drawElement(dotGlyph, gridsize, type='oval')
    
glyphNames = srcFont.selectedGlyphNames if len(srcFont.selectedGlyphNames) else srcFont.glyphOrder

for glyphName in glyphNames:
    if glyphName == DotScreenGlyph.elementGlyph:
        continue
    srcGlyph = srcFont[glyphName]
    dstGlyph = dstFont.newGlyph(glyphName)

    G = DotScreenGlyph(srcGlyph)
    G.gridSize = gridsize
    G.radius   = radius
    G.angle    = angle

    dotGlyph = G.makeGlyphComponents()
    dstGlyph.appendGlyph(dotGlyph)
    dstGlyph.width = dotGlyph.width
    dstGlyph.unicodes = srcGlyph.unicodes

dstFont.openInterface()