107 lines
8.7 KiB
HTML
107 lines
8.7 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module robofab.tools.accentBuilder</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="robofab.html"><font color="#ffffff">robofab</font></a>.<a href="robofab.tools.html"><font color="#ffffff">tools</font></a>.accentBuilder</strong></big></big></font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/code/projects/robofab/Lib/robofab/tools/accentBuilder.py">/code/projects/robofab/Lib/robofab/tools/accentBuilder.py</a></font></td></tr></table>
|
|
<p><tt>A simple set of tools for building accented glyphs.<br>
|
|
# Hey look! A demonstration:<br>
|
|
from robofab.accentBuilder import <a href="#AccentTools">AccentTools</a>, buildRelatedAccentList<br>
|
|
font = CurrentFont<br>
|
|
# a list of accented glyphs that you want to build<br>
|
|
myList=['Aacute', 'aacute']<br>
|
|
# search for glyphs related to glyphs in myList and add them to myList<br>
|
|
myList=<a href="#-buildRelatedAccentList">buildRelatedAccentList</a>(font, myList)+myList<br>
|
|
# start the class<br>
|
|
at=<a href="#AccentTools">AccentTools</a>(font, myList)<br>
|
|
# clear away any anchors that exist (this is optional)<br>
|
|
at.clearAnchors()<br>
|
|
# add necessary anchors if you want to<br>
|
|
at.buildAnchors(ucXOffset=20, ucYOffset=40, lcXOffset=15, lcYOffset=30)<br>
|
|
# print a report of any errors that occured<br>
|
|
at.printAnchorErrors()<br>
|
|
# build the accented glyphs if you want to<br>
|
|
at.buildAccents()<br>
|
|
# print a report of any errors that occured<br>
|
|
at.printAccentErrors()</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#aa55cc">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
|
|
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="robofab.html">robofab</a><br>
|
|
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="robofab.tools.accentBuilder.html#AccentTools">AccentTools</a>
|
|
</font></dt></dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="AccentTools">class <strong>AccentTools</strong></a></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="AccentTools-__init__"><strong>__init__</strong></a>(self, font, accentList)</dt><dd><tt>several tools for working with anchors and building accents</tt></dd></dl>
|
|
|
|
<dl><dt><a name="AccentTools-buildAccents"><strong>buildAccents</strong></a>(self, clear<font color="#909090">=True</font>, adjustWidths<font color="#909090">=True</font>, markGlyph<font color="#909090">=True</font>, doProgress<font color="#909090">=True</font>)</dt><dd><tt>build accented glyphs. some flag definitions:<br>
|
|
clear=1 clear the glyphs if they already exist<br>
|
|
markGlyph=1 mark the glyph that is created<br>
|
|
doProgress=1 show a progress bar<br>
|
|
adjustWidths=1 will fix right and left margins when left or right accents are added</tt></dd></dl>
|
|
|
|
<dl><dt><a name="AccentTools-buildAnchors"><strong>buildAnchors</strong></a>(self, ucXOffset<font color="#909090">=0</font>, ucYOffset<font color="#909090">=0</font>, lcXOffset<font color="#909090">=0</font>, lcYOffset<font color="#909090">=0</font>, markGlyph<font color="#909090">=True</font>, doProgress<font color="#909090">=True</font>)</dt><dd><tt>add the necessary anchors to the glyphs if they don't exist<br>
|
|
some flag definitions:<br>
|
|
uc/lc/X/YOffset=20 offset values for the anchors<br>
|
|
markGlyph=1 mark the glyph that is created<br>
|
|
doProgress=1 show a progress bar</tt></dd></dl>
|
|
|
|
<dl><dt><a name="AccentTools-clearAnchors"><strong>clearAnchors</strong></a>(self, doProgress<font color="#909090">=True</font>)</dt><dd><tt>clear all anchors in the font</tt></dd></dl>
|
|
|
|
<dl><dt><a name="AccentTools-printAccentErrors"><strong>printAccentErrors</strong></a>(self)</dt><dd><tt>print errors encounted during buildAccents</tt></dd></dl>
|
|
|
|
<dl><dt><a name="AccentTools-printAnchorErrors"><strong>printAnchorErrors</strong></a>(self)</dt><dd><tt>print errors encounted during buildAnchors</tt></dd></dl>
|
|
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#eeaa77">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl><dt><a name="-buildRelatedAccentList"><strong>buildRelatedAccentList</strong></a>(font, list)</dt><dd><tt>build a list of related glyphs suitable for use with <a href="#AccentTools">AccentTools</a></tt></dd></dl>
|
|
<dl><dt><a name="-findRelatedGlyphs"><strong>findRelatedGlyphs</strong></a>(font, searchItem, doAccents<font color="#909090">=True</font>)</dt><dd><tt>Gather up a bunch of related glyph names. Send it either a<br>
|
|
single glyph name 'a', or a list of glyph names ['a', 'x'] and it<br>
|
|
returns a dict like: {'a': ['atilde', 'a.alt', 'a.swash']}. if doAccents<br>
|
|
is False it will skip accented glyph names.<br>
|
|
This is a relatively slow operation!</tt></dd></dl>
|
|
<dl><dt><a name="-makeAccentName"><strong>makeAccentName</strong></a>(baseName, accentNames)</dt><dd><tt>make an accented glyph name</tt></dd></dl>
|
|
<dl><dt><a name="-nameBuster"><strong>nameBuster</strong></a>(glyphName, glyphConstruct)</dt></dl>
|
|
<dl><dt><a name="-stripSuffix"><strong>stripSuffix</strong></a>(glyphName)</dt><dd><tt>strip away unnecessary suffixes from a glyph name</tt></dd></dl>
|
|
</td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#55aa55">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
|
|
<td width="100%"><strong>accentColor</strong> = 75<br>
|
|
<strong>accents</strong> = ['acute', 'acutecomb', 'breve', 'caron', 'cedilla', 'circumflex', 'commaaccent', 'dblgrave', 'dieresis', 'dieresisacute', 'dieresisacute', 'dieresisgrave', 'dieresisgrave', 'dotaccent', 'grave', 'dblgrave', 'gravecomb', 'hungarumlaut', 'macron', 'ogonek', ...]<br>
|
|
<strong>anchorColor</strong> = 125<br>
|
|
<strong>inFontLab</strong> = False<br>
|
|
<strong>lowercase_plain</strong> = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', ...]<br>
|
|
<strong>uppercase_plain</strong> = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', ...]</td></tr></table>
|
|
</body></html> |