Dotscreen glyphs into a new font
Dotscreen glyphs from an existing font into another font with a script.
Steps
-
Open the font you wish to dotscreen.
-
Open the Scripting Window and paste the script below.
-
Adjust the values at the top of the script as needed.
-
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. -
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()