Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Commit

Permalink
initial and last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Oct 26, 2020
0 parents commit 164005a
Show file tree
Hide file tree
Showing 792 changed files with 73,032 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _downloads/RAnchor_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# robofab manual
# Anchor object
# usage examples

f = CurrentFont()

for g in f:
if len(g.anchors) > 0:
print g, g.anchors
9 changes: 9 additions & 0 deletions _downloads/RAnchor_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# robofab manual
# Anchor object
# attribute examples

g = CurrentGlyph()

if len(g.anchors) > 0:
for a in g.anchors:
print a.position
10 changes: 10 additions & 0 deletions _downloads/RComponent_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# the easiest way to get to a component
# is to get one from a glyph

from robofab.world import CurrentFont

f = CurrentFont()
g = f['adieresis']

for c in g.components:
print c
12 changes: 12 additions & 0 deletions _downloads/RComponent_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# robofab manual
# Component object
# attribute examples

print f['adieresis'].components[0].baseGlyph
print f['adieresis'].components[1].baseGlyph

# move the component in the base glyph
f['adieresis'].components[1].offset = (100,100)

# scale the component in the base glyph
f['adieresis'].components[0].scale = (.5, .25)
9 changes: 9 additions & 0 deletions _downloads/RContour_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# robofab manual
# Contour object
# usage examples

# take a glyph (one with outlines obviously)
c = CurrentGlyph()

# get to contours by index:
print c[0]
17 changes: 17 additions & 0 deletions _downloads/RFont_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# robofab manual
# Font object
# Usage examples

# start using the current font
from robofab.world import CurrentFont
f = CurrentFont()

# get a clean, empty new font object,
# appropriate for the current environment
f = robofab.world.RFont()

# get an open dialog and start a new font
f = OpenFont()

# open the font at path
f = OpenFont(path)
8 changes: 8 additions & 0 deletions _downloads/RFont_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# robofab manual
# Font object
# Iterate through the font object to get to the glyphs.

f = CurrentFont()

for glyph in f:
print glyph.name
8 changes: 8 additions & 0 deletions _downloads/RFont_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# cache the kerning object for speed

from robofab.world import CurrentFont

f = CurrentFont()

cachedKerning = f.kerning
# continue to use cachedKerning, not f.kerning.
17 changes: 17 additions & 0 deletions _downloads/RFont_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# robofab manual
# Font object
# attribute examples
# Most useful attributes of RFont
# are actually stored in RFont.info

f = CurrentFont()
print f.info.unitsPerEm

# kerning data is available in the kerning object:
print f.kerning

# len() gives you the "length" of the font, i.e. the number of glyphs
print "glyphs in this font:", len(f)

# treat a font object as a dictionary to get to the glyphs
print f["A"]
12 changes: 12 additions & 0 deletions _downloads/RFont_04.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# robofab manual
# Font object
# method examples

from robofab.world import CurrentFont
f = CurrentFont()

# the keys() method returns a list of glyphnames:
print f.keys()

# find unicodes for each glyph by using the postscript name:
f.autoUnicodes()
12 changes: 12 additions & 0 deletions _downloads/RFont_05.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# robofab manual
# Font object
# method examples, available in FontLab

from robofab.world import CurrentFont
f = CurrentFont()

# the keys() method returns a list of glyphnames:
print f.selection

# generate font binaries
f.generate('otfcff')
22 changes: 22 additions & 0 deletions _downloads/RGlyph_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# robofab manual
# Glyph object
# Usage examples

# start using the current font
from robofab.world import CurrentGlyph
g = CurrentGlyph()

# suppose you've done the right imports
# different ways of creating glyphs
# a new empty glyph object
g = robofab.world.RGlyph()

# a new empty fontlab glyph object
g = robofab.objects.objectsFL.RGlyph()

# a new empty robofab glyph object
g = robofab.objects.objectsRF.RGlyph()

# the easiest way to get a new glyph
# is to ask a font to make you one:
g = aFontObject[glyphName]
28 changes: 28 additions & 0 deletions _downloads/RGlyph_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# robofab manual
# Glyph object
# attribute examples

from robofab.world import CurrentFont, CurrentGlyph
f = CurrentFont()

# create a glyph object by asking the font
g = f["Adieresis"]

# alternatively, create a glyph object for the current glyph
g = CurrentGlyph()

# get the width
print g.width

# get the name
print g.name

# a list of unicode values for this glyph. Can be more than 1!
print g.unicodes

# set the width
g.width = 1000
print g.width

# get the number of contours in a glyph by getting its length
print len(g)
12 changes: 12 additions & 0 deletions _downloads/RGlyph_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# robofab manual
# Glyph object
# method examples

# get a glyph object from a font
f = CurrentFont()
g = f["A"]
print g

# move the glyph 10 units to the right, and 200 units up:
g = f["a"]
g.move((10, 200))
21 changes: 21 additions & 0 deletions _downloads/RGlyph_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# robofab manual
# Glyph object
# method examples

# In FontLab the baseglyph of a component can't be changed easily.
# This assumes that there will only be
# one component that needs to be remapped.

def remapComponent(glyph, oldBaseGlyph, newBaseGlyph):
foundComponent = None
for component in glyph.components:
if component.baseGlyph = oldBaseGlyph:
foundComponent = component
break
if foundComponent is None:
return
offset = foundComponent.offset
scale = foundComponent.scale
glyph.removeComponent(component)
glyph.appendComponent(newBaseGlyph, offset=offset, scale=scale)

21 changes: 21 additions & 0 deletions _downloads/RInfo_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# robofab manual
# Info object
# usage examples

from robofab.world import CurrentFont

f = CurrentFont()
print f.info.postscriptFullName
print f.info.openTypeNameDesigner

f.info.openTypeNameDesigner = "Jan van Krimpen"
print f.info.openTypeNameDesigner
print f.info.openTypeOS2VendorID
print f.info.unitsPerEm
print f.info.xHeight
print f.info.openTypeNameLicenseURL

# but you can set the values as well
f.info.postscriptUniqueID = 4309359
f.info.openTypeNameDesigner = "Eric Gill"

11 changes: 11 additions & 0 deletions _downloads/RKerning_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# robofab manual
# Kerning object
# usage examples

f = CurrentFont()
print f.kerning

# getting a value from the kerning dictionary
print f.kerning[('V', 'A')]
print f.kerning[('T', 'X')]
print f.kerning.keys()
9 changes: 9 additions & 0 deletions _downloads/RLib_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# robofab manual
# Lib object
# attribute examples

# RFont objects have a lib:
print aFont.lib

# content of the lib of a font exported from RoboFog
print f.lib.keys()
13 changes: 13 additions & 0 deletions _downloads/RPoint_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# robofab manual
# Point object
# usage examples

contour = CurrentGlyph()[0]
print contour.points[0]

from random import randint
for p in contour.points:
p.x += randint(-10,10)
p.y += randint(-10,10)

contour.update()
10 changes: 10 additions & 0 deletions _downloads/RSegment_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# robofab manual
# Segment object
# usage examples

f = OpenFont()

for g in f:
for contour in g:
for segment in contour:
print segment
16 changes: 16 additions & 0 deletions _downloads/RSegment_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# robofab manual
# Segment object
# attribute examples

f = OpenFont()

for g in f:
for contour in g:
for segment in contour:
print len(segment)
print segment.type
print segment.smooth
print segment.points
print segment.onCurve
print segment.offCurve
print segment.selected
10 changes: 10 additions & 0 deletions _downloads/RSegment_02.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# robofab manual
# Segment object
# method examples

f = OpenFont()

for g in f:
for contour in g:
for segment in contour:
segment.move((50, 25))
7 changes: 7 additions & 0 deletions _downloads/bPoint_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# robofab manual
# bPoint object
# Usage examples

g = CurrentGlyph()
for aPt in g[0].bPoints:
print aPt
8 changes: 8 additions & 0 deletions _downloads/bPoint_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# robofab manual
# bPoint object
# Attribute examples

g = CurrentGlyph()

for aPt in g[0].bPoints:
print aPt.bcpIn, aPt.bcpOut, aPt.anchor
12 changes: 12 additions & 0 deletions _downloads/buildingAccents_00.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# robofab manual
# Buildingaccents howto
# usage examples

from robofab.world import CurrentFont

f = CurrentFont()
f.newGlyph("aacute")
f["aacute"].appendComponent("a")
f["aacute"].appendComponent("acute", (200, 0))
f["aacute"].width = f["a"].width
f.update()
32 changes: 32 additions & 0 deletions _downloads/buildingAccents_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# robofab manual
# Buildingaccents howto
# AccentBuilder examples

from robofab.world import CurrentFont
from robofab.accentBuilder import AccentTools, buildRelatedAccentList

font = CurrentFont()

# a list of accented glyphs that you want to build
myList = ['Aacute', 'aacute']

# search for glyphs related to glyphs in myList and add them to myList
myList = buildRelatedAccentList(font, myList)+myList

# start the class
at = AccentTools(font, myList)

# clear away any anchors that exist (this is optional)
at.clearAnchors()

# add necessary anchors if you want to
at.buildAnchors(ucXOffset=20, ucYOffset=40, lcXOffset=15, lcYOffset=30)

# print a report of any errors that occured
at.printAnchorErrors()

# build the accented glyphs if you want to
at.buildAccents()

# print a report of any errors that occured
at.printAccentErrors()
Loading

0 comments on commit 164005a

Please sign in to comment.