Skip to content

Commit

Permalink
update extension
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Mar 17, 2020
1 parent ba3782d commit 6ecb3d8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 4 deletions.
6 changes: 6 additions & 0 deletions GlyphConstruction.roboFontExt/html/index.html
Expand Up @@ -129,6 +129,12 @@ <h4>Left and Right Margins</h4>
</pre></div>


<p>Use a <code>'</code> to flip to the opposite side of given glyph margin.</p>
<div class="codehilite"><pre><span></span><span class="err"># left margin is used for the right margin of the generate d.alt</span>
<span class="err">d.alt = d ^ d&#39;, d&#39;</span>
</pre></div>


<h3 id="decompose-glyph">Decompose glyph</h3>
<p>Add <code>*</code> before a glyph construction rule to explicitly tell the constructor to decompose the final result.</p>
<div class="codehilite"><pre><span></span><span class="err">*agrave = a + grave</span>
Expand Down
5 changes: 5 additions & 0 deletions GlyphConstruction.roboFontExt/html/index.md
Expand Up @@ -116,6 +116,11 @@ Width and margin values can also be defined using basic maths and references to
# right margin is equal to twice the right margin of B
Aacute = A + acute ^ A / 3, B * 2

Use a `'` to flip to the opposite side of given glyph margin.

# left margin is used for the right margin of the generate d.alt
d.alt = d ^ d', d'

### Decompose glyph

Add `*` before a glyph construction rule to explicitly tell the constructor to decompose the final result.
Expand Down
4 changes: 2 additions & 2 deletions GlyphConstruction.roboFontExt/info.plist
Expand Up @@ -30,8 +30,8 @@
<key>requiresVersionMinor</key>
<string>5</string>
<key>timeStamp</key>
<real>1581087441.2549529</real>
<real>1584475621.6245382</real>
<key>version</key>
<string>0.8</string>
<string>0.8.1</string>
</dict>
</plist>
20 changes: 19 additions & 1 deletion GlyphConstruction.roboFontExt/lib/glyphConstruction.py
Expand Up @@ -19,6 +19,8 @@
# < RF3.2
from ufoLib.pointPen import SegmentToPointPen

__versions__ = "0.0.3"

# splitters

glyphNameSplit = "="
Expand Down Expand Up @@ -1184,6 +1186,7 @@ def GlyphConstructionBuilder(construction, font, characterMap=None):
if kern:
t = Transform(*transformMatrix).translate(kern, 0)
transformMatrix = t[:]
advanceWidth += kern

baseTransformMatrix = transformMatrix
destination.addComponent(component, transformMatrix)
Expand Down Expand Up @@ -1504,7 +1507,22 @@ def testGlyphConstructionBuilder_Positioning():
"""


def testGlyphConstructionBuilder_():
def testGlyphConstructionBuilder_kerning():
"""
>>> font = testDummyFont()
>>> font.kerning["a", "i"] = -100
>>> result = GlyphConstructionBuilder("r = a & i", font)
>>> testDigestGlyph(result)
('r', 150, None, None, '', (('a', (1, 0, 0, 1, 0, 0), None), ('i', (1, 0, 0, 1, 60, 0), None)))
>>> result = GlyphConstructionBuilder("r = a & \\i", font)
>>> testDigestGlyph(result)
('r', 50, None, None, '', (('a', (1, 0, 0, 1, 0, 0), None), ('i', (1, 0, 0, 1, -40, 0), None)))
"""


def testGlyphConstructionBuilder():
"""
>>> font = testDummyFont()
Expand Down
2 changes: 1 addition & 1 deletion build-extension.py
Expand Up @@ -27,7 +27,7 @@
B.name = "Glyph Construction"
B.developer = 'Frederk Berlaen'
B.developerURL = 'http://typemytype.com/'
B.version = '0.8'
B.version = '0.8.1'
B.launchAtStartUp = True
B.mainScript = 'glyphConstructionUIStartUp.py'
B.html = True
Expand Down
5 changes: 5 additions & 0 deletions html/index.md
Expand Up @@ -116,6 +116,11 @@ Width and margin values can also be defined using basic maths and references to
# right margin is equal to twice the right margin of B
Aacute = A + acute ^ A / 3, B * 2

Use a `'` to flip to the opposite side of given glyph margin.

# left margin is used for the right margin of the generate d.alt
d.alt = d ^ d', d'

### Decompose glyph

Add `*` before a glyph construction rule to explicitly tell the constructor to decompose the final result.
Expand Down

0 comments on commit 6ecb3d8

Please sign in to comment.