| 1 |
Scripting functions |
| 2 |
=================== |
| 3 |
|
| 4 |
.. default-domain:: ff |
| 5 |
|
| 6 |
The built in procedures are very similar to the menu items with the same names. |
| 7 |
Often the description here is sketchy, look at the menu item for more |
| 8 |
information. |
| 9 |
|
| 10 |
I use a syntax like: |
| 11 |
|
| 12 |
:: |
| 13 |
|
| 14 |
Generate(filename[,bitmaptype[,fmflags[,res[,mult-sfd-file[,namelist-name]]]]]) |
| 15 |
|
| 16 |
To mean that arguments after the first are optional. However if you wish to set |
| 17 |
the fourth argument you must specify the second and third arguments too. |
| 18 |
|
| 19 |
.. function:: AddAccent(accent[,pos]) |
| 20 |
|
| 21 |
There must be exactly one glyph selected. That glyph must contain at least |
| 22 |
one reference (and the least recently added reference must be the base glyph |
| 23 |
-- the letter on which the accent is placed). The first argument should be |
| 24 |
either the glyph-name of an accent, or the unicode code point of that accent |
| 25 |
(and it should be in the font). The second argument, if present indicates how |
| 26 |
the accent should be positioned... if omitted a default position will be |
| 27 |
chosen from the unicode value for the accent, this argument is the or of the |
| 28 |
following flags: |
| 29 |
|
| 30 |
0x100 |
| 31 |
Above |
| 32 |
0x200 |
| 33 |
Below |
| 34 |
0x400 |
| 35 |
Overstrike |
| 36 |
0x800 |
| 37 |
Left |
| 38 |
0x1000 |
| 39 |
Right |
| 40 |
0x4000 |
| 41 |
Center Left |
| 42 |
0x8000 |
| 43 |
Center Right |
| 44 |
0x10000 |
| 45 |
Centered Outside |
| 46 |
0x20000 |
| 47 |
Outside |
| 48 |
0x40000 |
| 49 |
Left Edge |
| 50 |
0x80000 |
| 51 |
Right Edge |
| 52 |
0x100000 |
| 53 |
Touching |
| 54 |
|
| 55 |
.. function:: AddAnchorClass(name,type,lookup-subtable-name) |
| 56 |
|
| 57 |
These mirror the values of the Anchor class dialog of |
| 58 |
:menuselection:`Element --> Font Info`. The first argument should be a utf8 |
| 59 |
encoded name for the anchor class. The second should be one of the strings |
| 60 |
"default", "mk-mk", or "cursive". The third should be a lookup subtable name. |
| 61 |
|
| 62 |
.. function:: AddAnchorPoint(name,type,x,y[,lig-index]) |
| 63 |
|
| 64 |
Adds an AnchorPoint to the currently selected glyph. The first argument is |
| 65 |
the name of the AnchorClass. The second should be one of the strings: "mark", |
| 66 |
"basechar" (or "base"), "baselig" (or "ligature"), "basemark", "cursentry" |
| 67 |
(or "entry") , "cursexit" (or "exit") or "default" ("default" tries to guess |
| 68 |
an appropriate setting for you). The next two values specify the location of |
| 69 |
the point. The final argument is only present for things of type "baselig". |
| 70 |
|
| 71 |
.. function:: AddDHint(x1,y1,x2,y2,unit.x,unit.y) |
| 72 |
|
| 73 |
Adds a diagonal hint. A diagonal hint requires two points on opposite sides of |
| 74 |
the stem and a unit vector in the direction of the stem. |
| 75 |
|
| 76 |
.. function:: AddExtrema([all]) |
| 77 |
|
| 78 |
If a spline in a glyph reaches a maximum or minimum x or y value within a |
| 79 |
spline then break the spline so that there will be a point at all significant |
| 80 |
extrema. (If this point is too close to an end-point then the end-point |
| 81 |
itself may be moved. There are various other caveats. See |
| 82 |
:menuselection:`Element --> `:ref:`AddExtrema <elementmenu.Add-Extrema>` for |
| 83 |
more information). If the "all" argument is specified and is a nonzero |
| 84 |
integer, then all extrema will be added; otherwise, some that would be very |
| 85 |
close to existing endpoints will not be added. |
| 86 |
|
| 87 |
.. function:: AddInflections() |
| 88 |
|
| 89 |
If the curvature of a spline in a glyph changes sign then break the spline |
| 90 |
so that there will be a point at all points of inflection. |
| 91 |
|
| 92 |
.. function:: Balance() |
| 93 |
|
| 94 |
For all cubic bezier splines of the glyph make the line between the control |
| 95 |
points parallel to the chord such that the area is preserved. This is an |
| 96 |
improved version of the algorithm known as "tunnify". |
| 97 |
|
| 98 |
.. function:: Harmonize() |
| 99 |
|
| 100 |
For all bezier splines of the glyph move the smooth on-curve points between |
| 101 |
its adjacent control points such that the adjacent curvatures become equal. |
| 102 |
|
| 103 |
.. function:: AddHHint(start,width) |
| 104 |
|
| 105 |
Adds horizontal stem hint to any selected glyphs. The hint starts at location |
| 106 |
"start" and is width wide. A hint will be added to all selected glyphs. |
| 107 |
|
| 108 |
.. function:: AddInstrs(thingamy,replace,instrs) |
| 109 |
|
| 110 |
Where thingamy is a string, either "fpgm" or "prep" in which case it refers |
| 111 |
to that truetype table (which will be created if need be), or a glyph-name in |
| 112 |
which case it refers to that glyph, or a null string in which case any |
| 113 |
selected characters will be used. |
| 114 |
|
| 115 |
Where replace is an integer. If zero then the instructions will be appended |
| 116 |
to any already present. If non-zero then the instructions will replace those |
| 117 |
already present. |
| 118 |
|
| 119 |
And instrs is a string containing fontforge's human readable version of tt |
| 120 |
instructions, as "``IUP[x]\nIUP[y]``" |
| 121 |
|
| 122 |
.. function:: AddLookup(name,type,flags,features-script-lang-array[,after-lookup-name) |
| 123 |
|
| 124 |
Creates a new lookup with the given name, type and flags. It will tag it with |
| 125 |
any indicated features. The type of one of |
| 126 |
|
| 127 |
* gsub_single |
| 128 |
* gsub_multiple |
| 129 |
* gsub_alternate |
| 130 |
* gsub_ligature |
| 131 |
* gsub_context |
| 132 |
* gsub_contextchain |
| 133 |
* gsub_revesechain |
| 134 |
* morx_indic |
| 135 |
* morx_context |
| 136 |
* morx_insert |
| 137 |
* gpos_single |
| 138 |
* gpos_pair |
| 139 |
* gpos_cursive |
| 140 |
* gpos_mark2base |
| 141 |
* gpos_mark2ligature |
| 142 |
* gpos_mark2mark |
| 143 |
* gpos_context |
| 144 |
* gpos_contextchain |
| 145 |
* kern_statemachine |
| 146 |
|
| 147 |
The lookup flags define what glyphs to include or ignore. |
| 148 |
|
| 149 |
0 |
| 150 |
Include all glyphs |
| 151 |
8 |
| 152 |
Ignore mark_class_cnt |
| 153 |
16 |
| 154 |
Ignore mark_set_cnt |
| 155 |
|
| 156 |
A feature-script-lang array is an array with one entry for each feature |
| 157 |
(there may be no entries if there are no features). Each entry is itself a |
| 158 |
two element array, the first entry is a string containing a 4 letter feature |
| 159 |
tag, and the second entry is another array (potentially empty) with an entry |
| 160 |
for each script for which the feature is active. Each entry here is itself a |
| 161 |
two element array. The first element is a 4 letter script tag and the second |
| 162 |
is an array of languages. Each entry in the language array is a four letter |
| 163 |
language. Example: [["liga",[["latn",["dflt"]]]]] |
| 164 |
|
| 165 |
The optional final argument allows you to specify the ordering of the lookup. |
| 166 |
If not specified the lookup will be come the first lookup in its table. |
| 167 |
|
| 168 |
.. function:: AddLookupSubtable(lookup-name,new-subtable-name[,after-subtable]) |
| 169 |
|
| 170 |
Creates a new subtable within the specified lookup. The optional final |
| 171 |
argument allows you to specify the ordering within the lookup. If not |
| 172 |
specified this subtable will be first in the lookup. |
| 173 |
|
| 174 |
.. function:: AddPosSub(subtable-name,variant-glyph-name(s)) |
| 175 |
AddPosSub(subtable-name,dx,dy,dadv_x,dadv_y) |
| 176 |
AddPosSub(subtable-name,other-glyph-name,dx1,dy1,dadv_x1,dadv_y1,dx2,dy2,dadv_x2,dadv_y2) |
| 177 |
|
| 178 |
One glyph must be selected. The arguments of the command depend on the type |
| 179 |
of the lookup containing the subtable. |
| 180 |
|
| 181 |
.. function:: AddSizeFeature(default-size[,range-bottom,range-top,style-id,array-of-lang-names]) |
| 182 |
|
| 183 |
This allows you to specify an OpenType 'size' feature. It will also set the |
| 184 |
TeX design size header value. |
| 185 |
|
| 186 |
The 'size' feature has two formats. The simplest one specifies the optical |
| 187 |
design size for the font, the more complex one specifies that as well as a |
| 188 |
design range, a style id, and a list of language/name pairs (at least one of |
| 189 |
which must be in English). |
| 190 |
|
| 191 |
The design range is a range of point sizes for which this font is to be |
| 192 |
preferred. For instance you might have a family of fonts with the following |
| 193 |
attributes: |
| 194 |
|
| 195 |
.. list-table:: |
| 196 |
:header-rows: 1 |
| 197 |
:class: compact |
| 198 |
|
| 199 |
* - Optical design size |
| 200 |
- Bottom of range |
| 201 |
- Top of range |
| 202 |
- Style name |
| 203 |
* - 18 |
| 204 |
- 13 |
| 205 |
- 72 |
| 206 |
- Title |
| 207 |
* - 10 |
| 208 |
- 12.9 |
| 209 |
- 8.0 |
| 210 |
- Text |
| 211 |
* - 6 |
| 212 |
- 7.9 |
| 213 |
- 5 |
| 214 |
- Tiny |
| 215 |
|
| 216 |
The list of language/name pairs should be an array of arrays. All the |
| 217 |
sub-arrays should have two entries, the first, an integer which represents an |
| 218 |
MS language id, the second a string containing the name of the style in that |
| 219 |
language. |
| 220 |
|
| 221 |
:: |
| 222 |
|
| 223 |
New() |
| 224 |
AddSizeFeature(10,8,12.9,211,[[0x409,"Text"],[0x40c,"Texte"]]) |
| 225 |
|
| 226 |
This will set the current font to have a design size of 10 points, this font |
| 227 |
will then be used in preference to other fonts in its family if the requested |
| 228 |
size is between 8 and 12.9 points. The 211 is used by applications to |
| 229 |
associate font families into smaller groups based on optical size. The final |
| 230 |
argument specifies that this size be called "Text" in English and "Texte" in |
| 231 |
French (0x409 is the ms language code for US English, 0x40c is the code for |
| 232 |
French from France). |
| 233 |
|
| 234 |
* `The size feature is documented by Adobe <http://partners.adobe.com/public/developer/opentype/index_tag8.html#size>`__ |
| 235 |
* `MS language values are documented with the 'name' table <http://partners.adobe.com/public/developer/opentype/index_name.html#lang3>`__ |
| 236 |
|
| 237 |
.. function:: AddVHint(start,width) |
| 238 |
|
| 239 |
Adds a vertical stem hint to any selected glyphs. The hint starts at location |
| 240 |
"start" and is width wide. A hint will be added to all selected glyphs. |
| 241 |
|
| 242 |
.. function:: ApplySubstitution(script,lang,tag) |
| 243 |
|
| 244 |
All three arguments must be strings of no more that four characters (shorter |
| 245 |
strings will be padded with blanks to become 4 character strings). For each |
| 246 |
selected glyph this command will look up that glyph's list of substitutions, |
| 247 |
and if it finds a substitution with the tag "tag" (and if that substitution |
| 248 |
matches the script and language combination) then it will apply the |
| 249 |
substitution-- that is it will find the variant glyph specified in the |
| 250 |
substitution and replace the current glyph with the variant, and clear the |
| 251 |
variant. |
| 252 |
|
| 253 |
FontForge recognizes the string "*" as a wildcard for both the script and the |
| 254 |
language (not for the tag though). So if you wish to replace all glyphs with |
| 255 |
their vertical variants: |
| 256 |
|
| 257 |
:: |
| 258 |
|
| 259 |
SelectAll() |
| 260 |
ApplySubstitution("*","*","vrt2") |
| 261 |
|
| 262 |
.. function:: Array(size) |
| 263 |
|
| 264 |
Allocates an array of the indicated size. |
| 265 |
|
| 266 |
:: |
| 267 |
|
| 268 |
a = Array(10) |
| 269 |
i = 0; |
| 270 |
while ( i<10 ) |
| 271 |
a[i] = i++ |
| 272 |
endloop |
| 273 |
a[3] = "string" |
| 274 |
a[4] = Array(10) |
| 275 |
a[4][0] = "Nested array"; |
| 276 |
|
| 277 |
It can execute with no current font. |
| 278 |
|
| 279 |
.. function:: AskUser(question[,default-answer]) |
| 280 |
|
| 281 |
Asks the user the question and returns an answer (a string). A default-answer |
| 282 |
may be specified too. It can execute with no current font. |
| 283 |
|
| 284 |
.. function:: ATan2(val1,val2) |
| 285 |
|
| 286 |
Returns the arc-tangent. See atan2(3) for more info. It can execute with no |
| 287 |
current font. |
| 288 |
|
| 289 |
.. function:: AutoCounter() |
| 290 |
|
| 291 |
Generates (PostScript) counter masks for selected glyphs automagically. |
| 292 |
|
| 293 |
.. function:: AutoHint() |
| 294 |
|
| 295 |
Generates (PostScript) hints for selected glyphs automagically. |
| 296 |
|
| 297 |
.. function:: AutoInstr() |
| 298 |
|
| 299 |
Generates (TrueType) instructions for selected glyphs. |
| 300 |
|
| 301 |
.. function:: AutoKern(spacing,threshold,subtable-name[,kernfile]) |
| 302 |
|
| 303 |
(AutoKern doesn't work well in general) |
| 304 |
|
| 305 |
Guesses at kerning pairs by looking at all selected glyphs, store the new |
| 306 |
kerning pairs in the indicated subtable, or if a kernfile is specified, |
| 307 |
FontForge will read the kern pairs out of the file. |
| 308 |
|
| 309 |
.. function:: AutoTrace() |
| 310 |
|
| 311 |
If you have either potrace or autotrace installed, this will invoke them on |
| 312 |
the selected glyphs to trace the background image and generate splines. |
| 313 |
|
| 314 |
.. function:: AutoWidth(spacing) |
| 315 |
|
| 316 |
Guesses at the widths of all selected glyphs so that two adjacent "I" glyphs |
| 317 |
will appear to be spacing em-units apart. (if spacing is the negative of the |
| 318 |
em-size (sum of ascent and descent) then a default value will be used). |
| 319 |
|
| 320 |
.. function:: BitmapsAvail(sizes[,rasterized]) |
| 321 |
|
| 322 |
Controls what bitmap sizes are stored in the font's database. It is passed an |
| 323 |
array of sizes. If a size is specified which is not in the font database it |
| 324 |
will be generated. If a size is not specified which is in the font database |
| 325 |
it will be removed. A size which is specified and present in the font |
| 326 |
database will not be touched. |
| 327 |
|
| 328 |
If you want to specify greymap fonts then the low-order 16 bits will be the |
| 329 |
pixel size and the high order 16 bits will specify the bits/pixel. Thus |
| 330 |
0x8000c would be a 12 pixel font with 8 bits per pixel, while either 0xc or |
| 331 |
0x1000c could be used to refer to a 12 pixel bitmap font. |
| 332 |
|
| 333 |
If you want to create blank strikes (with no glyphs in them) set the optional |
| 334 |
rasterized parameter to 0. |
| 335 |
|
| 336 |
.. function:: BitmapsRegen(sizes) |
| 337 |
|
| 338 |
Allows you to update specific bitmaps in an already generated bitmap font. It |
| 339 |
will regenerate the bitmaps of all selected glyphs at the specified |
| 340 |
pixelsizes. |
| 341 |
|
| 342 |
.. function:: BuildAccented() |
| 343 |
|
| 344 |
If any of the selected glyphs are accented, then clear them and create a new |
| 345 |
glyph by inserting references to the appropriate base glyph and accents. |
| 346 |
|
| 347 |
.. function:: BuildComposite() |
| 348 |
|
| 349 |
Similar to BuildAccented but will build any composite glyph -- ligatures and |
| 350 |
what not. |
| 351 |
|
| 352 |
.. function:: BuildDuplicate() |
| 353 |
|
| 354 |
Changes the encoding so that to encoding points share the same glyph. |
| 355 |
|
| 356 |
.. function:: CanonicalContours() |
| 357 |
|
| 358 |
Orders the contours in the currently selected glyph(s) by the x coordinate of |
| 359 |
their leftmost point. (This can reduce the size of the charstring needed to |
| 360 |
describe the glyph(s). |
| 361 |
|
| 362 |
.. function:: CanonicalStart() |
| 363 |
|
| 364 |
Sets the start point of all the contours of the currently selected glyph(s) |
| 365 |
to be the leftmost point on the contour. (If there are several points with |
| 366 |
that value then use the one which is closest to the baseline). This can |
| 367 |
reduce the size of the charstring needed to describe the glyph(s). By |
| 368 |
regularizing things it can also make more things available to be put in |
| 369 |
subroutines. |
| 370 |
|
| 371 |
.. function:: Ceil(real) |
| 372 |
|
| 373 |
Converts a real number to the smallest integer larger than the real. It can |
| 374 |
execute with no current font. |
| 375 |
|
| 376 |
See Also :func:`Int()`, :func:`Round()` and :func:`Floor()`. |
| 377 |
|
| 378 |
.. function:: CenterInWidth() |
| 379 |
|
| 380 |
Centers any selected glyphs so that their right and left side bearings are |
| 381 |
equal. |
| 382 |
|
| 383 |
.. function:: ChangePrivateEntry(key,val) |
| 384 |
|
| 385 |
Changes (or adds if the key is not already present) the value in the |
| 386 |
dictionary indexed by key. (all values must be strings even if they represent |
| 387 |
numbers in PostScript) |
| 388 |
|
| 389 |
.. function:: ChangeWeight(em-units) |
| 390 |
|
| 391 |
:ref:`Emboldens <elementmenu.Embolden>` the selected glyphs by the given |
| 392 |
amount in em units. If em-units is a negative number, the glyphs are made |
| 393 |
less bold. |
| 394 |
|
| 395 |
.. function:: CharCnt() |
| 396 |
|
| 397 |
Returns the number of encoding slots (or encoding slots + unencoded glyphs) |
| 398 |
in the current font |
| 399 |
|
| 400 |
.. function:: CharInfo(str) |
| 401 |
|
| 402 |
Deprecated name for :func:`GlyphInfo()` |
| 403 |
|
| 404 |
.. function:: CheckForAnchorClass(name) |
| 405 |
|
| 406 |
Returns 1 if the current font contains an Anchor class with the given name |
| 407 |
(which must be in utf8). |
| 408 |
|
| 409 |
.. function:: Chr(int) |
| 410 |
Chr(array) |
| 411 |
|
| 412 |
Takes an integer [-128,255] and returns a single character string containing |
| 413 |
that byte. Negative numbers are treated as signed bytes in two's complement. |
| 414 |
Internally FontForge interprets strings as if they were in UTF-8, so it is |
| 415 |
possible to construct higher code points and strings that are not valid UTF-8 |
| 416 |
by passing in appropriate values. If passed an array, it should be an array |
| 417 |
of integers and the result is the string. It can execute with no current |
| 418 |
font. |
| 419 |
|
| 420 |
.. function:: CIDChangeSubFont(new-sub-font-name) |
| 421 |
|
| 422 |
If the current font is a cid keyed font, this command changes the active |
| 423 |
sub-font to be the one specified (the string should be the postscript |
| 424 |
FontName of the subfont) |
| 425 |
|
| 426 |
.. function:: CIDFlatten() |
| 427 |
|
| 428 |
Flattens a cid-keyed font. |
| 429 |
|
| 430 |
.. function:: CIDFlattenByCMap(cmap-filename) |
| 431 |
|
| 432 |
Flattens a cid-keyed font, producing a font encoded with the result of the |
| 433 |
CMAP file. |
| 434 |
|
| 435 |
.. function:: CIDSetFontNames(fontname[,family[,fullname[,weight[,copyright-notice]]]]) |
| 436 |
|
| 437 |
Sets various postscript names associated with the top level cid font. If a |
| 438 |
name is omitted (or is the empty string) it will not be changed. (this is |
| 439 |
just like SetFontNames except it works on the top level cid font rather than |
| 440 |
the current font). |
| 441 |
|
| 442 |
.. function:: Clear |
| 443 |
|
| 444 |
Clears out all selected glyphs |
| 445 |
|
| 446 |
.. function:: ClearBackground |
| 447 |
|
| 448 |
Clears the background of all selected glyphs |
| 449 |
|
| 450 |
.. function:: ClearCharCounterMasks() |
| 451 |
|
| 452 |
Deprecated name for :func:`ClearGlyphCounterMasks()` |
| 453 |
|
| 454 |
.. function:: ClearGlyphCounterMasks() |
| 455 |
|
| 456 |
Clears any counter masks from the (one) selected glyph. |
| 457 |
|
| 458 |
.. function:: ClearHints() |
| 459 |
ClearHints("Vertical") |
| 460 |
ClearHints("Horizontal") |
| 461 |
ClearHints("Diagonal") |
| 462 |
|
| 463 |
Clears any (PostScript) hints from the selected instructions. The first form |
| 464 |
clears all hints, the other three clear either all vertical, all horizontal |
| 465 |
or all diagonal hints respectively. |
| 466 |
|
| 467 |
.. function:: ClearInstrs() |
| 468 |
|
| 469 |
Clears any (TrueType) instructions from selected glyphs |
| 470 |
|
| 471 |
.. function:: ClearPrivateEntry(key) |
| 472 |
|
| 473 |
Removes the entry indexed by the given key from the private dictionary of the |
| 474 |
font. |
| 475 |
|
| 476 |
.. function:: ClearTable(tag) |
| 477 |
|
| 478 |
Removes the table named tag. This may be 'fpgm', 'prep', 'cvt ', 'maxp' or |
| 479 |
any user defined tables. It returns 1 if it found (and removed) the table, 0 |
| 480 |
if the table was not present. |
| 481 |
|
| 482 |
.. function:: Close() |
| 483 |
|
| 484 |
This frees up any memory taken up by the current font and drops it off the |
| 485 |
list of loaded fonts. After this executes there will be no current font. |
| 486 |
|
| 487 |
.. function:: CompareFonts(other-font-filename,output-filename,flags) |
| 488 |
|
| 489 |
This will compare the current font with the font in ``other-font-filename`` |
| 490 |
(which must already have been opened). It will write the results to the |
| 491 |
``output-filename``, you may use "-" to send the output to stdout. The |
| 492 |
``flags`` argument controls what will be compared. |
| 493 |
|
| 494 |
.. rubric:: Flags |
| 495 |
|
| 496 |
0x1 |
| 497 |
compare outlines |
| 498 |
0x2 |
| 499 |
compare outlines exactly (otherwise allow slight errors and the unlinking |
| 500 |
of references) |
| 501 |
0x4 |
| 502 |
warn if the outlines don't exactly match (but are pretty close) |
| 503 |
0x8 |
| 504 |
compare hints |
| 505 |
0x10 |
| 506 |
compare hintmasks |
| 507 |
0x20 |
| 508 |
compare hintmasks only if the glyph has hint conflicts |
| 509 |
0x40 |
| 510 |
warn if references need to be unlinked before a match is found |
| 511 |
0x80 |
| 512 |
compare bitmap strikes |
| 513 |
0x100 |
| 514 |
compare font names |
| 515 |
0x200 |
| 516 |
compare glyph positioning |
| 517 |
0x400 |
| 518 |
compare glyph substitutions |
| 519 |
0x800 |
| 520 |
for any glyphs whose outlines differ, add the outlines of the glyph in the |
| 521 |
second font to the background of the glyph in the first |
| 522 |
0x1000 |
| 523 |
if a glyph exists in the second font but not the first, create that glyph |
| 524 |
in the first and add the outlines from the second into the backgroun layer |
| 525 |
|
| 526 |
.. function:: CompareGlyphs([pt_err[,spline_err[,pixel_off_frac[,bb_err[,compare_hints[,report_diffs_as_errors]]]]]]) |
| 527 |
|
| 528 |
This function compares two versions of one or several glyphs. It looks at any |
| 529 |
selected glyphs in the font and compares them to an equivalent glyph in the |
| 530 |
clipboard (there must be the same number of selected glyphs as glyphs in the |
| 531 |
clipboard). |
| 532 |
|
| 533 |
* It checks to make sure the advance width of each glyph pair is similar |
| 534 |
* It checks to make sure that each contains the same set of references |
| 535 |
* It checks to make sure that all points (both base and control) are within |
| 536 |
pt_err of each other |
| 537 |
* If that fails then it performs a slower check to see if points lying along |
| 538 |
the contours have equivalent points in the other glyph (that is: If you have |
| 539 |
simplified a glyph and are comparing it to the original, this check should |
| 540 |
pass it while the previous check would fail). |
| 541 |
* Optionally you may check that the bitmaps match. |
| 542 |
* Optionally you may check if hints (and hintmasks) match. |
| 543 |
|
| 544 |
The first argument controls the accuracy with which points must match. A |
| 545 |
value of 0 is an exact match and will also check hints. If you provide a |
| 546 |
negative value then this test will be skipped. |
| 547 |
|
| 548 |
The second argument controls the accuracy with which the contour check must |
| 549 |
match. A value of 0 will not work due to rounding errors in the process. A |
| 550 |
negative value will skip the test. |
| 551 |
|
| 552 |
The third argument controls bitmap tests. A negative value (the default) will |
| 553 |
mean no bitmap tests are done. A value of 0 requires an exact match of the |
| 554 |
bitmap. A value between 0 and 1 specifies the fraction of the pixel range |
| 555 |
that will be accepted for a match (so in a greymap with a depth of 8 the |
| 556 |
pixel range in 256, and a fraction value of .25 would mean any pixel value |
| 557 |
within 64 (.25*256) would match). |
| 558 |
|
| 559 |
The fourth argument controls how different the bounding boxes of anti-aliased |
| 560 |
bitmaps can be (the bounding boxes of bitmaps with depth 1 must match |
| 561 |
exactly) |
| 562 |
|
| 563 |
The fifth argument controls whether to tests hints and hintmasks. A value of |
| 564 |
1 tests hints, 2 tests hintmasks and 3 tests both, a value of 7 will test |
| 565 |
hintmasks only in glyphs with conflicts. |
| 566 |
|
| 567 |
Normally this function treats any differences it finds as errors and stops |
| 568 |
the script. If you set the sixth argument to 0 then it will return a value |
| 569 |
which ors the following flags together (some flags indicate errors, others |
| 570 |
unusual conditions, others success -- the function will never return both an |
| 571 |
error and success flag, but it can return several success flags at once if |
| 572 |
you are comparing more than one glyph) |
| 573 |
|
| 574 |
1 |
| 575 |
Different numbers of contours in a glyph |
| 576 |
2 |
| 577 |
A contour in one glyph is open when the corresponding contour is closed |
| 578 |
4 |
| 579 |
Disordered contours (contours are in different orders in the two glyphs) |
| 580 |
8 |
| 581 |
Disordered start (the start point is at a different place in the two |
| 582 |
glyphs) |
| 583 |
16 |
| 584 |
Disordered direction (the contour is clockwise in one and counter in the |
| 585 |
other) |
| 586 |
32 |
| 587 |
Glyphs match by checking points |
| 588 |
64 |
| 589 |
Glyphs match by checking the contours |
| 590 |
128 |
| 591 |
Outline glyphs do not match |
| 592 |
256 |
| 593 |
Different references in the two glyphs (or different transformation |
| 594 |
matrices) |
| 595 |
512 |
| 596 |
Different advance widths in the two glyphs |
| 597 |
1024 |
| 598 |
Different vertical advance widths in the two glyphs |
| 599 |
2048 |
| 600 |
Different hints in the two glyphs |
| 601 |
4096 |
| 602 |
Different hintmasks in the two glyphs |
| 603 |
8192 |
| 604 |
Different numbers of layers in the two glyphs |
| 605 |
16384 |
| 606 |
Contours do not match in the two glyphs |
| 607 |
32768 |
| 608 |
We only find a match after we have unlinked references |
| 609 |
65536 |
| 610 |
Bitmap glyphs have different depths |
| 611 |
2*65536 |
| 612 |
Bitmap glyphs have different bounding boxes |
| 613 |
4*65536 |
| 614 |
Bitmaps are different |
| 615 |
8*65536 |
| 616 |
Bitmap glyphs do not match (set with all the above) |
| 617 |
16*65536 |
| 618 |
Bitmap glyphs match |
| 619 |
|
| 620 |
.. function:: ConvertByCMap(cmapfilename) |
| 621 |
|
| 622 |
Converts current font to a CID-keyed font using specified CMap file. |
| 623 |
cmapfilename must be a path name of a file conforming Adobe CMap File Format. |
| 624 |
|
| 625 |
.. function:: ConvertToCID(registry, ordering, supplement) |
| 626 |
|
| 627 |
Converts current font to a CID-keyed font using given registry, ordering and |
| 628 |
supplement. registry and ordering must be strings, supplement must be a |
| 629 |
integer. |
| 630 |
|
| 631 |
.. function:: Copy |
| 632 |
|
| 633 |
Makes a copy of all selected glyphs. |
| 634 |
|
| 635 |
.. function:: CopyAnchors |
| 636 |
|
| 637 |
Copies all the anchor points in a glyph. |
| 638 |
|
| 639 |
.. function:: CopyFgToBg |
| 640 |
|
| 641 |
Copies all foreground splines into the background in all selected glyphs |
| 642 |
|
| 643 |
.. function:: CopyLBearing |
| 644 |
|
| 645 |
Stores the left side bearing of all selected glyphs in the clipboard |
| 646 |
|
| 647 |
.. function:: CopyRBearing |
| 648 |
|
| 649 |
Stores the right side bearing of all selected glyphs in the clipboard |
| 650 |
|
| 651 |
.. function:: CopyReference |
| 652 |
|
| 653 |
Makes references to all selected glyphs and stores them in the clipboard. |
| 654 |
|
| 655 |
.. function:: CopyUnlinked |
| 656 |
|
| 657 |
Makes a copy of all selected glyphs, just as :ref:`Copy <editmenu.Copy>` |
| 658 |
does. However if a glyph contains a reference, then the reference will be |
| 659 |
unlinked (turned into splines) before it is added to the clipboard. |
| 660 |
|
| 661 |
.. function:: CopyVWidth |
| 662 |
|
| 663 |
Stores the vertical widths of all selected glyphs in the clipboard |
| 664 |
|
| 665 |
.. function:: CopyWidth |
| 666 |
|
| 667 |
Stores the widths of all selected glyphs in the clipboard |
| 668 |
|
| 669 |
.. function:: CorrectDirection([unlinkrefs]) |
| 670 |
|
| 671 |
If an argument is present it must be integral and is treated as a flag |
| 672 |
controlling whether flipped references should be unlinked before the |
| 673 |
CorrectDirection code runs. If the argument is not present, or if it has a |
| 674 |
non-zero value then flipped references will be unlinked. |
| 675 |
|
| 676 |
.. function:: Cos(val) |
| 677 |
|
| 678 |
Returns the cosine of val. It can execute with no current font. |
| 679 |
|
| 680 |
.. function:: Cut |
| 681 |
|
| 682 |
Makes a copy of all selected glyphs and saves it in the clipboard, then |
| 683 |
clears out the selected glyphs |
| 684 |
|
| 685 |
.. function:: DefaultOtherSubrs() |
| 686 |
|
| 687 |
Returns to using Adobe's versions of the OtherSubrs subroutines. It can |
| 688 |
execute with no current font. |
| 689 |
|
| 690 |
.. function:: DefaultRoundToGrid() |
| 691 |
|
| 692 |
Looks at all selected glyphs, if any reference is not positioned by point |
| 693 |
matching, then FontForge will set the truetype "ROUND-TO-GRID" flag for the |
| 694 |
reference. |
| 695 |
|
| 696 |
.. function:: DefaultUseMyMetrics() |
| 697 |
|
| 698 |
Looks at all selected glyphs. If any glyph contains references, does not have |
| 699 |
the "USE-MY-METRICS" bit set on any of those references, and if one of those |
| 700 |
references has the same width as the current glyph, and has an identity |
| 701 |
transformation matrix, then set the bit on that reference. |
| 702 |
|
| 703 |
.. function:: DetachAndRemoveGlyphs() |
| 704 |
|
| 705 |
Any selected encoding slots will have their glyph pointer nulled out. In |
| 706 |
addition, if this glyph is now unencoded it will remove the glyph from the |
| 707 |
font. |
| 708 |
|
| 709 |
.. function:: DetachGlyphs() |
| 710 |
|
| 711 |
Any selected encoding slots will have their glyph pointer nulled out. This |
| 712 |
does not remove the glyph from the font, it just makes it unreachable through |
| 713 |
this encoding slot. |
| 714 |
|
| 715 |
.. function:: DontAutoHint() |
| 716 |
|
| 717 |
Mark any selected glyphs so that they will not be AutoHinted when saving the |
| 718 |
font. (This flag is cleared if the user explicitly AutoHints the glyph |
| 719 |
himself). |
| 720 |
|
| 721 |
.. function:: DrawsSomething([arg]) |
| 722 |
|
| 723 |
Arg is as in :func:`InFont()`. This returns true if the |
| 724 |
glyph contains any splines, references or images. |
| 725 |
|
| 726 |
.. function:: Error(str) |
| 727 |
|
| 728 |
Prints out str as an error message and aborts the current script. It can |
| 729 |
execute with no current font. |
| 730 |
|
| 731 |
.. function:: Exp(val) |
| 732 |
|
| 733 |
Returns e:sup:`val`. It can execute with no current font. |
| 734 |
|
| 735 |
.. function:: ExpandStroke(width) |
| 736 |
ExpandStroke(width, line cap, line join) |
| 737 |
ExpandStroke(width, line cap, line join, 0, flags) |
| 738 |
ExpandStroke(width, calligraphic-angle, height-numerator, height-denom) |
| 739 |
ExpandStroke(width, calligraphic-angle, height-numerator, height-denom, 0, flags) |
| 740 |
ExpandStroke(type, width, height, angle, line cap, line join, join limit, extend cap, accuracy, flags) |
| 741 |
|
| 742 |
In the first format a line cap of "butt" and line join of "round" are |
| 743 |
implied. In the fourth and fifth formats both line cap and the line join are |
| 744 |
set to "nib". |
| 745 |
|
| 746 |
.. object:: Type |
| 747 |
|
| 748 |
When using the last form the type must be one of: 0=>circular/elliptical, |
| 749 |
1=>calligraphic/rectangular, 2=>convex/polygonal. |
| 750 |
|
| 751 |
.. object:: Width |
| 752 |
|
| 753 |
In the PostScript "stroke" command the width is the distance between the |
| 754 |
two generated curves. To be more precise, at ever point on the original |
| 755 |
curve, a point will be added to each of the new curves at width/2 units as |
| 756 |
measured on a vector normal to the direction of the original curve at that |
| 757 |
point. This is equivalent to the value being the diameter of a circular |
| 758 |
nib. |
| 759 |
|
| 760 |
With a calligraphic pen the width is the width of the pen used to draw the |
| 761 |
curve. |
| 762 |
|
| 763 |
With a convex pen (and therefore the last, longest parameter set) this |
| 764 |
second argument is not interpreted as a width, but as the identifier of a |
| 765 |
convex nib context: 0=> the default context, -10=> the "FreeHand" nib, |
| 766 |
-11=> the Expand Stroke nib. (The negative contexts are only available |
| 767 |
when the UI is enabled.) The nibs cannot currently be altered with native |
| 768 |
scripting functions, but when executing scripts in interactive FontForge |
| 769 |
the Expand Stroke and FreeHand nibs can be changed using their respective |
| 770 |
dialogs. |
| 771 |
|
| 772 |
.. object:: Line cap |
| 773 |
|
| 774 |
One of: 0=> butt, 1=>round, 2=>square, 3=>nib |
| 775 |
|
| 776 |
.. object:: Line join |
| 777 |
|
| 778 |
One of: 0=>miter, 1=>round, 2=>bevel, 3=>nib, 4=>miterclip, 5=>arcs |
| 779 |
|
| 780 |
.. object:: Caligraphic/nib angle |
| 781 |
|
| 782 |
The (fixed) angle at which the pen is held in units of degrees. |
| 783 |
|
| 784 |
.. object:: Height-numerator/denominator |
| 785 |
|
| 786 |
In the legacy parameter sets these two values specify a ratio between the |
| 787 |
height and the width of a calligraphic pen: |
| 788 |
|
| 789 |
height = numerator * width / denominator |
| 790 |
|
| 791 |
This syntax stems from a point in FontForge development before floating |
| 792 |
point numbers could be passed to a script function. |
| 793 |
|
| 794 |
.. object:: Height |
| 795 |
|
| 796 |
In the longer call style, this is the height of a calligraphic nib or the |
| 797 |
minoraxis length of an elliptical nib. Setting this to 0 is equivalent to |
| 798 |
supplying the same value as Width. |
| 799 |
|
| 800 |
.. object:: Join limit, extend cap, accuracy target |
| 801 |
|
| 802 |
These values are explained in the stroke facility documentation linked |
| 803 |
above. |
| 804 |
|
| 805 |
.. object:: Flags |
| 806 |
|
| 807 |
This is an integer bit field used to set these boolean flags, which are |
| 808 |
further explained in the stroke facility documentation linked above. |
| 809 |
|
| 810 |
1 => remove internal contour |
| 811 |
|
| 812 |
2 => remove external contour |
| 813 |
|
| 814 |
(you may not remove both contours) |
| 815 |
|
| 816 |
4 => run remove-overlap on individual contours |
| 817 |
|
| 818 |
8 => do not run remove-overlap |
| 819 |
|
| 820 |
(by default remove-overlap is run on the whole layer) |
| 821 |
|
| 822 |
16 => skip simplify step |
| 823 |
|
| 824 |
32 => do not add extrema |
| 825 |
|
| 826 |
64 => (if relevant) join limit is in em-units |
| 827 |
|
| 828 |
(by default the join limit is in units of nib width/2 |
| 829 |
|
| 830 |
128 => (if relevant) extend cap is in em-units |
| 831 |
|
| 832 |
(by default extend cap is in units of nib width/2) 256 => Force SVG 2 Arcs |
| 833 |
Join clip algorithm |
| 834 |
|
| 835 |
512 => Force Ratio Arcs Join clip algorithm |
| 836 |
|
| 837 |
(otherwise the algorithm is picked based on other values) |
| 838 |
|
| 839 |
.. function:: Export(format[,bitmap-size]) |
| 840 |
|
| 841 |
For each selected glyph in the current font, this command will export that |
| 842 |
glyph into a file in the current directory. Format must be a string and must |
| 843 |
end with one of |
| 844 |
|
| 845 |
* ``eps`` -- the selected glyphs will have their splines output into eps files. |
| 846 |
* ``pdf`` -- the selected glyphs will have their splines output into pdf files. |
| 847 |
* ``svg`` -- the selected glyphs will have their splines output into svg files. |
| 848 |
* ``fig`` -- the selected glyphs will have their splines converted (badly) into |
| 849 |
xfig files. |
| 850 |
* ``xbm`` -- The second argument specifies a bitmap font size, the selected |
| 851 |
glyphs in that bitmap font will be output as xbm files. |
| 852 |
* ``bmp`` -- The second argument specifies a bitmap font size, the selected |
| 853 |
glyphs in that bitmap font will be output as bmp files. |
| 854 |
* ``png`` -- The second argument specifies a bitmap font size, the selected |
| 855 |
glyphs in that bitmap font will be output as png files. |
| 856 |
|
| 857 |
The format may consist entirely of the filetype (extension, see above), or it |
| 858 |
may include a full filename (with some format control within it) which has |
| 859 |
the file type as an extension: :: |
| 860 |
|
| 861 |
"Glyph %n from font %f.svg" |
| 862 |
"U+%U.bmp" |
| 863 |
|
| 864 |
If the format consists entirely of a filetype then FontForge will use a |
| 865 |
format of ``"%n_%f.<filetype>"`` |
| 866 |
|
| 867 |
All characters in the format string except for % are copied verbatim. If |
| 868 |
there is a % then the following character controls behavior: |
| 869 |
|
| 870 |
* ``%n`` -- inserts the glyph name (or the first 40 characters of it for long |
| 871 |
names) |
| 872 |
* ``%f`` -- inserts the font name (or the first 40 characters) |
| 873 |
* ``%e`` -- inserts the glyph's encoding as a decimal integer |
| 874 |
* ``%u`` -- inserts the glyph's unicode code point in lower case hex |
| 875 |
* ``%U`` -- inserts the glyph's unicode code point in upper case hex |
| 876 |
* ``%%`` -- inserts a single '%' |
| 877 |
|
| 878 |
If you select one of the types that generate an image (xbm, bmp, png) then |
| 879 |
you must specify a second argument contain a bitmap-size. FontForge will |
| 880 |
search the list of bitmap strikes in the font data base and use the images in |
| 881 |
the matching strike. It will NOT rasterize an image for you here. For bitmap |
| 882 |
strikes just use the pixel size, for grey scale strikes use the |
| 883 |
``(depth of the grey scale<<16) + pixel_size``, in most cases the depth will |
| 884 |
be 8. |
| 885 |
|
| 886 |
If there is a third argument it must also be an integer and provides a set of |
| 887 |
flags: |
| 888 |
|
| 889 |
* 1 => Flip the y-axis of exported SVGs with a transform element (instead of rewriting values) |
| 890 |
* 256 => Use current Export dialog settings (other flags are ignored) |
| 891 |
* 512 => Present Export options dialog (if UI is enabled) |
| 892 |
|
| 893 |
.. function:: FileAccess(filename[,prot]) |
| 894 |
|
| 895 |
Behaves like the unix access system call. Returns 0 if the file exists, -1 if |
| 896 |
it does not. If protection is omitted, checks for read access. It can execute |
| 897 |
with no current font. |
| 898 |
|
| 899 |
.. function:: FindIntersections() |
| 900 |
|
| 901 |
Finds everywhere that splines cross and creates points there. |
| 902 |
|
| 903 |
.. function:: FindOrAddCvtIndex(value[,sign-matters]) |
| 904 |
|
| 905 |
Returns the index in the cvt table of the given value. If the value does not |
| 906 |
exist in the table it will be added, and an index at the end of the table |
| 907 |
will be returned. Most tt instructions ignore the sign of items in the cvt |
| 908 |
table, but a few care. Usually this command stores the absolute value of |
| 909 |
value, but if sign-matters is present and non-zero a negative value can be |
| 910 |
looked up (or added). |
| 911 |
|
| 912 |
.. function:: Floor(real) |
| 913 |
|
| 914 |
Converts a real number to the largest integer smaller than the real. It can |
| 915 |
execute with no current font. |
| 916 |
|
| 917 |
See Also :func:`Ceil()`, :func:`Int()` and :func:`Round()`. |
| 918 |
|
| 919 |
.. function:: FontImage(filename,array[,width[,height]]) |
| 920 |
|
| 921 |
Produces a thumbnail image of the font and stores it in the given filename. |
| 922 |
Images may be stored in either png or bmp format (png requires that you have |
| 923 |
libpng on your system). The array is a list of pairs of [pointsize, |
| 924 |
utf8-string] each of which specifies a line of text for the image. The width |
| 925 |
need not be specified, if omitted (or specified as -1) the image will be just |
| 926 |
wide enough to contain the longest string. The height need not be specified, |
| 927 |
if omitted (or specified as -1) it will be just long enough to contain all |
| 928 |
the lines. :: |
| 929 |
|
| 930 |
FontImage("FontImage.png",[17,"abcd",38,"ABCD"]) |
| 931 |
|
| 932 |
produces |
| 933 |
|
| 934 |
.. image:: /images/FontImage.png |
| 935 |
|
| 936 |
.. function:: FontsInFile(filename) |
| 937 |
|
| 938 |
Returns an array of strings containing the names of all fonts within a file. |
| 939 |
Most files contain one font, but some (mac font suitcases, dfonts, ttc files, |
| 940 |
svg files, etc) may contain several. If the file contains no fonts (or the |
| 941 |
file doesn't exist, or the fonts aren't named), a zero length array is |
| 942 |
returned. It does not open the font. It can execute without a current font. |
| 943 |
|
| 944 |
.. function:: Generate(filename[,bitmaptype[,fmflags[,res[,mult-sfd-file[,namelist-name]]]]]) |
| 945 |
|
| 946 |
Generates a font. The type of font is determined by the extension of the |
| 947 |
filename. Valid extensions are: |
| 948 |
|
| 949 |
* .pfa |
| 950 |
* .pfb |
| 951 |
* .bin (a mac postscript (pfb) resource in a mac binary wrapper) |
| 952 |
|
| 953 |
.res (on the Mac itself FontForge will put the result directly into a font |
| 954 |
suitcase file, and the extension should be ".res" rather than ".bin") |
| 955 |
|
| 956 |
.. note:: |
| 957 |
|
| 958 |
You must also create a bitmap font in NFNT format or the mac will not |
| 959 |
recognize your postscript font. |
| 960 |
* *%s*.pf[ab] (here more than just an extension is required, the font name must |
| 961 |
contain a "%s") (splits a big font up into multiple pfb fonts each with 256 |
| 962 |
characters, making use of the fifth argument to determine how this is done). |
| 963 |
The "%s" will be replaced by the fontnumber specified in the mult-sfd-file. |
| 964 |
* .mm.pfa (multiple master font in ascii format) |
| 965 |
* .mm.pfb (multiple master font in binary format) |
| 966 |
* .pt3 (type 3) |
| 967 |
* .ps (type 0) |
| 968 |
* .t42 (type 42, truetype wrapped in PostScript) |
| 969 |
* .cid.t42 (type 42 cid font) |
| 970 |
* .cid (non-otf cid font) |
| 971 |
* .cff (bare cff font) |
| 972 |
* .cid.cff (bare cff cid-keyed font) |
| 973 |
* .ttf |
| 974 |
* .sym.ttf (a truetype file with a symbol (custom) encoding) |
| 975 |
* .ttf.bin (a mac truetype resource in a mac binary wrapper) |
| 976 |
|
| 977 |
suit (on the Mac itself FontForge will put the result directly into a font |
| 978 |
suitcase file, and the extension should be ".suit" not ".ttf.bin") |
| 979 |
* .dfont (a mac truetype resource in a dfont file) |
| 980 |
* .otf (either cid or not depending on the font) |
| 981 |
* .otf.dfont (a mac opentype resource in a dfont file) |
| 982 |
* .svg (an svg font) |
| 983 |
* <null extension> If you don't want to generate an outline font at all (but do |
| 984 |
want to provide a filename for bitmap or metrics files) then provide a null |
| 985 |
extension (ie. ``"Times."`` but NOT ``"Times"``) -- the generated bitmap |
| 986 |
fonts will have appropriate extensions for their font types, the "." is |
| 987 |
merely a placeholder. |
| 988 |
|
| 989 |
If present, bitmaptype may be one of: |
| 990 |
|
| 991 |
* bdf |
| 992 |
* ttf (for EBDT/bdat table in truetype/opentype) |
| 993 |
* sbit (for bdat table in truetype without any outline font in a dfont wrapper) |
| 994 |
* bin (for nfnt in macbinary) |
| 995 |
|
| 996 |
.. note:: |
| 997 |
|
| 998 |
Mac OS/X does not appear to support NFNT bitmaps. However even though |
| 999 |
unused itself, an NFNT bitmap must be present for a resource based type1 |
| 1000 |
postscript font to be used. (More accurately the obsolete FOND must be |
| 1001 |
present, and that will only be present if an obsolete NFNT is also present) |
| 1002 |
* fnt (For windows FNT format) |
| 1003 |
* otb (For X11 opentype bitmap format) |
| 1004 |
* pdb (for :doc:`palm bitmap fonts </techref/palmfonts>`) |
| 1005 |
* pt3 (for a postscript type3 bitmap font) |
| 1006 |
* "" for no bitmaps |
| 1007 |
|
| 1008 |
.. note:: |
| 1009 |
|
| 1010 |
If you request bitmap output then all strikes in the current font |
| 1011 |
database will be output, but this command will not create bitmaps, so if |
| 1012 |
there are no strikes in your font database, no strikes will be output (even |
| 1013 |
if you ask for them). If you wish to output bitmaps you must first create |
| 1014 |
them with the :func:`BitmapsAvail()` scripting command or |
| 1015 |
:ref:`Element->Bitmaps Avail <elementmenu.Bitmaps>`. |
| 1016 |
|
| 1017 |
.. rubric:: fmflags controls |
| 1018 |
|
| 1019 |
* -1 => default (generate an afm file for postscript fonts, never generate a |
| 1020 |
pfm file, full 'post' table, ttf hints) |
| 1021 |
* fmflags&1 => generate an afm file (if you are generating a multiple master |
| 1022 |
font then setting this flag means you get several afm files (one for each |
| 1023 |
master design, and one for the default version of the font) and an amfm file) |
| 1024 |
* fmflags&2 => generate a pfm file |
| 1025 |
* fmflags&4 => generate a short 'post' table with no glyph name info in it. |
| 1026 |
* fmflags&8 => do not include ttf instructions |
| 1027 |
* fmflags&0x10 => where apple and ms/adobe differ about the format of a |
| 1028 |
true/open type file, use apple's definition (otherwise use ms/adobe) |
| 1029 |
|
| 1030 |
Currently this affects bitmaps stored in the font (Apple calls the table |
| 1031 |
'bdat', ms/adobe 'EBDT'), the PostScript name in the 'name' table (Apple says |
| 1032 |
it must occur exactly once, ms/adobe say at least twice), and whether |
| 1033 |
morx/feat/kern/opbd/prop/lcar or GSUB/GPOS/GDEF tables are generated. |
| 1034 |
* fmflags&0x20 => generate a ':ref:`PfEd <non-standard.PfEd>`' table and store |
| 1035 |
glyph comments |
| 1036 |
* fmflags&0x40 => generate a ':ref:`PfEd <non-standard.PfEd>`' table and store |
| 1037 |
glyph colors |
| 1038 |
* fmflags&0x80 => generate tables so the font will work on both Apple and MS |
| 1039 |
platforms. |
| 1040 |
|
| 1041 |
Apple has screwed up and in Mac 10.4 (Tiger), if OpenType tables are present |
| 1042 |
in a font then the AAT tables will be ignored -- or so I'm told (I can't test |
| 1043 |
this myself). Unfortunately Apple does not implement all of OpenType, so the |
| 1044 |
result is almost certain to be wrong). |
| 1045 |
* If you want neither OpenType nor Apple tables (just an old fashioned 'kern' |
| 1046 |
table and nothing else) then set both 0x80 and 0x10. |
| 1047 |
* fmflags&0x100 => generate a glyph map file (GID=>glyph name, unicode map). |
| 1048 |
The map file will have extension ".g2n". |
| 1049 |
* fmflags&0x200 => generate a ':ref:`TeX <non-standard.TeX>` ' table containing |
| 1050 |
(most) TeX font metrics information |
| 1051 |
* fmflags&0x400 => generate an ofm file (for omega) |
| 1052 |
* fmflags&0x800 => generate an old style 'kern'ing table. Only meaningful if |
| 1053 |
set with OpenType (GPOS/GSUB) tables and without Apple tables. |
| 1054 |
* fmflags&0x2000 => use a symbol cmap entry (same as .sym.ttf, except you can |
| 1055 |
now specify a filename ending in .ttf) |
| 1056 |
* fmflags&0x8000 => do not generate an 'FFTM' table |
| 1057 |
* fmflags&0x10000 => generate a tfm file |
| 1058 |
* fmflags&0x40000 => do not do flex hints |
| 1059 |
* fmflags&0x80000 => do not include postscript hints |
| 1060 |
* fmflags&0x200000 => round postscript coordinates |
| 1061 |
* fmflags&0x400000 => add composite (mark to base) information to the afm file |
| 1062 |
* fmflags&0x800000 => store lookup and lookup subtable names in the 'PfEd' |
| 1063 |
table |
| 1064 |
* fmflags&0x1000000 => store guidelines in the 'PfEd' table |
| 1065 |
* fmflags&0x2000000 => store the background (and spiro) layers in the 'PfEd' |
| 1066 |
table |
| 1067 |
|
| 1068 |
res controls the resolution of generated bdf fonts. A value of -1 means |
| 1069 |
fontforge will guess for each strike. |
| 1070 |
|
| 1071 |
If the filename contains a "%s" and has either a ".pf[ab]" extension then a |
| 1072 |
"mult-sfd-file" may be present. This is the filename of a file containing the |
| 1073 |
mapping from the current encoding into the subfonts. |
| 1074 |
`Here is an example <https://fontforge.org/downloads/Big5.txt>`__. If this file is not present |
| 1075 |
FontForge will go through its default search process to find a file for the |
| 1076 |
encoding, and if it fails the fonts will not be saved. |
| 1077 |
|
| 1078 |
.. function:: GenerateFamily(filename,bitmaptype,fmflags,array-of-font-filenames) |
| 1079 |
|
| 1080 |
Generates a mac font family (FOND) from the fonts (which must be loaded) in |
| 1081 |
the array-of-font-filenames. filename, bitmaptype, fmflags are as in |
| 1082 |
:func:`Generate()`. |
| 1083 |
|
| 1084 |
:: |
| 1085 |
|
| 1086 |
#!/usr/local/bin/fontforge |
| 1087 |
a = Array($argc-1) |
| 1088 |
i = 1 |
| 1089 |
j = 0 |
| 1090 |
while ( i < $argc ) |
| 1091 |
# Open each of the fonts |
| 1092 |
Open($argv[i], 1) |
| 1093 |
# and store the filenames of all the styles in the array |
| 1094 |
a[j] = $filename |
| 1095 |
j++ |
| 1096 |
i++ |
| 1097 |
endloop |
| 1098 |
|
| 1099 |
GenerateFamily("All.otf.dfont","dfont",16,a) |
| 1100 |
|
| 1101 |
.. function:: GenerateFeatureFile(filename[,lookup-name]) |
| 1102 |
|
| 1103 |
Generates an adobe feature file for the current font. If a lookup name is |
| 1104 |
specified, then only data for that lookup will be output. |
| 1105 |
|
| 1106 |
.. function:: GetAnchorPoints() |
| 1107 |
|
| 1108 |
Return an array of arrays, one sub-array for each anchor point in the |
| 1109 |
currently selected glyph. The sub-arrays contain: the AnchorClass name, the |
| 1110 |
type name of the point (mark, base, ligature, basemark, entry, exit), the x |
| 1111 |
and y coordinates, and (for ligatures) the ligature component index. |
| 1112 |
|
| 1113 |
.. function:: GetCvtAt(index) |
| 1114 |
|
| 1115 |
Return the value in the cvt table at the given index. |
| 1116 |
|
| 1117 |
.. function:: GetEnv(str) |
| 1118 |
|
| 1119 |
Returns the value of the unix environment variable named by str. It can |
| 1120 |
execute with no current font. |
| 1121 |
|
| 1122 |
.. function:: GetFontBoundingBox() |
| 1123 |
|
| 1124 |
Returns a 4 element array containing [minimum-x-value, minimum-y-value, |
| 1125 |
maximum-x-value, maximum-y-value] of the entire font. |
| 1126 |
|
| 1127 |
.. function:: GetLookupInfo(lookup-name) |
| 1128 |
|
| 1129 |
Returns an array whose entries are: [lookup-type, lookup-flags, |
| 1130 |
feature-script-lang-array] The lookup type is a string as described in |
| 1131 |
:func:`AddLookup()`, and the feature-script-lang array is also described |
| 1132 |
in :func:`AddLookup()`. |
| 1133 |
|
| 1134 |
.. function:: GetLookups(table-name) |
| 1135 |
|
| 1136 |
The table name is either "GPOS" or "GSUB". Returns an array of all lookup |
| 1137 |
names in that table. |
| 1138 |
|
| 1139 |
.. function:: GetLookupSubtables(lookup-name) |
| 1140 |
|
| 1141 |
Returns an array of all subtable names in that lookup. |
| 1142 |
|
| 1143 |
.. function:: GetLookupOfSubtable(subtable-name) |
| 1144 |
|
| 1145 |
Returns the name of the lookup containing this subtable. |
| 1146 |
|
| 1147 |
.. function:: GetMaxpValue(field-name) |
| 1148 |
|
| 1149 |
Field name can be the same set of tag strings as :func:`SetMaxpValue()`. |
| 1150 |
|
| 1151 |
.. function:: GetOS2Value(field-name) |
| 1152 |
|
| 1153 |
The argument takes the same set of tag strings as :func:`SetOS2Value()`. |
| 1154 |
``VendorId`` returns a string, and ``Panose`` returns an array. The |
| 1155 |
others return integers. |
| 1156 |
|
| 1157 |
.. function:: GetPosSub(lookup-subtable-name) |
| 1158 |
|
| 1159 |
One glyph must be selected, this returns information about GPOS/GSUB features |
| 1160 |
attached to this glyph (It will not return information about class based |
| 1161 |
kerning or contextual features -- nothing that applies to the font as a whole |
| 1162 |
-- just things relating to the current glyph). The argument must be a |
| 1163 |
lookup-subtable name (or "*") and only information about the current glyph in |
| 1164 |
that subtable will be returned, if the argument is "*" all subtable |
| 1165 |
information will be returned. If nothing matches a 0 length array will be |
| 1166 |
returned. |
| 1167 |
|
| 1168 |
Each sub-array contains the following information |
| 1169 |
|
| 1170 |
* The subtable name |
| 1171 |
* The type (As a string, One of |
| 1172 |
``Position, Pair, Substitution, AltSubs, MultSubs`` or ``Ligature``) |
| 1173 |
|
| 1174 |
The remaining entries depend on the type. |
| 1175 |
|
| 1176 |
.. object:: For Positions |
| 1177 |
|
| 1178 |
There will be 4 numbers indicating respectively the contents of a GPOS |
| 1179 |
value record (dx,dy,d_horizontal_advance,d_vertical_advance) |
| 1180 |
|
| 1181 |
.. object:: For Pairs |
| 1182 |
|
| 1183 |
A string containing the name of the other glyph in the pair |
| 1184 |
|
| 1185 |
A list of 8 numbers indicating the contents of two GPOS value records (the |
| 1186 |
first four numbers control the current glyph, the next four numbers |
| 1187 |
control the second glyph) |
| 1188 |
|
| 1189 |
.. object:: For Substitutions |
| 1190 |
|
| 1191 |
A string containing the name of a glyph with which the current glyph is to |
| 1192 |
be replaced. |
| 1193 |
|
| 1194 |
.. object:: For the others |
| 1195 |
|
| 1196 |
A set of glyph names, one for each component. |
| 1197 |
|
| 1198 |
Examples: |
| 1199 |
|
| 1200 |
:: |
| 1201 |
|
| 1202 |
>Select("ffl") |
| 1203 |
>Print( GetPosSub("Latin ligatures",) |
| 1204 |
[[Latin Ligatures ,Ligature,f,f,l], |
| 1205 |
[Latin Ligatures ,Ligature,ff,l]] |
| 1206 |
>Select("T") |
| 1207 |
>Print( GetPosSub("*")) |
| 1208 |
[[Latin kerns ,Pair,u,0,0,-76,0,0,0,0,0], |
| 1209 |
[Latin kerns ,Pair,e,0,0,-92,0,0,0,0,0], |
| 1210 |
[Latin kerns ,Pair,a,0,0,-92,0,0,0,0,0], |
| 1211 |
[Latin kerns ,Pair,o,0,0,-76,0,0,0,0,0]] |
| 1212 |
>Select("onehalf") |
| 1213 |
>Print( GetPosSub("Fractions")) |
| 1214 |
[[Fractions ,Ligature,one,slash,two], |
| 1215 |
[Fractions ,Ligature,one,fraction,two]] |
| 1216 |
|
| 1217 |
.. function:: GetPref(str) |
| 1218 |
|
| 1219 |
Gets the value of the preference item whose name is contained in str. Only |
| 1220 |
boolean, integer, real, string and file preference items may be returned. |
| 1221 |
Boolean and real items are returned with integer type and file items are |
| 1222 |
returned with string type. Encodings (NewCharset) are returned as magic |
| 1223 |
numbers, these are meaningless outside the context of get/set Pref. It can |
| 1224 |
execute with no current font. |
| 1225 |
|
| 1226 |
.. function:: GetPrivateEntry(key) |
| 1227 |
|
| 1228 |
Returns the entry indexed by key in the private dictionary. All return values |
| 1229 |
will be strings. If an entry does not exist a null string is returned. |
| 1230 |
|
| 1231 |
.. function:: GetTeXParam(index) |
| 1232 |
|
| 1233 |
If index == -1 then the tex font type will be returned (text==0, math==1, |
| 1234 |
math extended=2) |
| 1235 |
|
| 1236 |
Else index is used to index into the font's tex params array. |
| 1237 |
|
| 1238 |
.. function:: GetSubtableOfAnchor(anchor-class-name) |
| 1239 |
|
| 1240 |
Returns the name of the lookup subtable containing this anchor class. |
| 1241 |
|
| 1242 |
.. function:: GetTTFName(lang,nameid) |
| 1243 |
|
| 1244 |
The lang and nameid arguments are as in :func:`SetTTFName()`. This returns |
| 1245 |
the current value as a utf8 encoded string. Combinations which are not |
| 1246 |
present will be returned as "". |
| 1247 |
|
| 1248 |
.. function:: GlyphInfo(str) |
| 1249 |
GlyphInfo("Kern",glyph-spec) |
| 1250 |
GlyphInfo("VKern",glyph-spec) |
| 1251 |
GlyphInfo(str,script,lang,tag) |
| 1252 |
GlyphInfo(str,position) |
| 1253 |
|
| 1254 |
There must be exactly one glyph selected in the font, and this returns |
| 1255 |
information on it. The information returned depends on str with the obvious |
| 1256 |
meanings: |
| 1257 |
|
| 1258 |
* "Name" returns the glyph's name |
| 1259 |
* "Unicode" returns the glyph's unicode encoding |
| 1260 |
* "Encoding" returns the glyph's encoding in the current font |
| 1261 |
* "Width" returns the glyph's width |
| 1262 |
* "VWidth" returns the glyph's Vertical width |
| 1263 |
* "TeXHeight" returns the tex_height field (a value of 0x7fff indicates that a |
| 1264 |
default value will be used) |
| 1265 |
* "TeXDepth" returns the tex_depth field (a value of 0x7fff indicates that a |
| 1266 |
default value will be used) |
| 1267 |
* "TeXSubPos" returns the tex_sub_pos field (a value of 0x7fff indicates that a |
| 1268 |
default value will be used) |
| 1269 |
* "TeXSuperPos" returns the tex_super_pos field (a value of 0x7fff indicates |
| 1270 |
that a default value will be used) |
| 1271 |
* "LBearing" returns the glyph's left side bearing |
| 1272 |
* "RBearing" returns the glyph's right side bearing |
| 1273 |
* "BBox" returns a 4 element array containing [minimum-x-value, |
| 1274 |
minimum-y-value, maximum-x-value, maximum-y-value] of the glyph. |
| 1275 |
* "ValidationState" returns a bitmask of the glyph's validation state. (See the |
| 1276 |
:py:attr:`fontforge.glyph.validation_state` for the bit break down) |
| 1277 |
* "Kern" (there must be a second argument here which specifies another glyph as |
| 1278 |
in Select()) Returns the kern offset between the two glyphs (or 0 if none). |
| 1279 |
* "VKern" (there must be a second argument here which specifies another glyph |
| 1280 |
as in Select()) Returns the vertical kern offset between the two glyphs (or 0 |
| 1281 |
if none). |
| 1282 |
* "Xextrema" (there must be a second argument here which specifies the vertical |
| 1283 |
position) Returns a two element array containing the minimum and maximum |
| 1284 |
horizontal positions on the contours of the glyph at the given vertical |
| 1285 |
position. If the position is beyond the glyph's bounding box the minimum |
| 1286 |
value will be set to 1 and the max to 0 (ie. max<min which is impossible). |
| 1287 |
* "Yextrema" (there must be a second argument here which specifies the |
| 1288 |
horizontal position) Returns a two element array containing the minimum and |
| 1289 |
maximum vertical positions on the contours of the glyph at the given |
| 1290 |
horizontal position. If the position is beyond the glyph's bounding box the |
| 1291 |
minimum value will be set to 1 and the max to 0 (ie. max<min which is |
| 1292 |
impossible). |
| 1293 |
* "Class" returns the glyph's class as one of the following strings: |
| 1294 |
"automatic", "none", "base", "ligature", "mark", "component", or "unknown". |
| 1295 |
* "Color" returns the glyph's color as a 24bit rgb value (or -2 if no color has |
| 1296 |
been assigned to the glyph). |
| 1297 |
* p "Comment" returns the glyph's comment (it will be converted from unicode |
| 1298 |
into the default encoding). |
| 1299 |
* "Changed" returns whether the glyph has been changed since the last save or |
| 1300 |
load. |
| 1301 |
* "DontAutoHint" returns the status of the "Don't AutoHint" flag. |
| 1302 |
* "Position" takes three additional arguments, a script, a language and a tag |
| 1303 |
(all 4 character strings) and returns whether the glyph has a Position |
| 1304 |
alternate with that tag. |
| 1305 |
* "GlyphIndex" returns the index of the current glyph in the ttf 'glyf' table, |
| 1306 |
or -1 if it has been created since. This value may change when a |
| 1307 |
truetype/opentype font is generated (to the index in the generated font). |
| 1308 |
* "PointCount" returns the number of points in the glyph (this means different |
| 1309 |
things in different modes). |
| 1310 |
* "LayerCount" returns the number of layers in the glyph. This will always be 2 |
| 1311 |
(foreground & background) except in the case of a multilayered font. |
| 1312 |
* "RefCount" returns the number of references in the glyph |
| 1313 |
* "RefNames" returns an array containing the names of all glyphs referred to. |
| 1314 |
This may contain 0 elements. This may contain a glyph twice ("colon" might |
| 1315 |
refer twice to period) |
| 1316 |
* "RefTransform" returns an array of arrays. The bottom most arrays are 6 |
| 1317 |
element (real) transformation matrices which are applied to their respective |
| 1318 |
glyphs. |
| 1319 |
* "XProfile" takes an integer as its second argument and returns an array of |
| 1320 |
intersection points between the foreground layer and a line y=<the second |
| 1321 |
argument>. The array is sorted. |
| 1322 |
* "YProfile" takes an integer as its second argument and returns an array of |
| 1323 |
intersection points between the foreground layer and a line x=<the second |
| 1324 |
argument>. The array is sorted. |
| 1325 |
|
| 1326 |
Examples: |
| 1327 |
|
| 1328 |
:: |
| 1329 |
|
| 1330 |
Select("A") |
| 1331 |
lbearing = GlyphInfo("LBearing") |
| 1332 |
Select(0u410) |
| 1333 |
SetLBearing(lbearing) |
| 1334 |
|
| 1335 |
.. function:: HasPreservedTable(tag) |
| 1336 |
|
| 1337 |
Returns true if the font contains a preserved table with the given tag. |
| 1338 |
|
| 1339 |
.. function:: HasPrivateEntry(key) |
| 1340 |
|
| 1341 |
Returns whether key exists in the private dictionary. |
| 1342 |
|
| 1343 |
.. function:: HasSpiro() |
| 1344 |
|
| 1345 |
Returns true if Raph Levien's spiro package is available in FontForge. |
| 1346 |
|
| 1347 |
.. function:: HFlip([about-x]) |
| 1348 |
|
| 1349 |
All selected glyphs will be horizontally flipped about the vertical line |
| 1350 |
through x=about-x. If no argument is given then all selected glyphs will be |
| 1351 |
flipped about their central point. |
| 1352 |
|
| 1353 |
.. function:: Import(filename[,toback[,flags]]) |
| 1354 |
|
| 1355 |
Either imports a bitmap font into the database, or imports background |
| 1356 |
image[s] into various glyphs. There may be one or two arguments. The first |
| 1357 |
must be a string representing a filename. The extension of the file |
| 1358 |
determines how the import proceeds. |
| 1359 |
|
| 1360 |
* If the extension is ".bdf" then a bdf font will be imported |
| 1361 |
* If the extension is ".pcf" then a pcf font will be imported. |
| 1362 |
* If the extension is ".ttf" then the EBDT or bdat table of the ttf file will |
| 1363 |
be searched for bitmap fonts |
| 1364 |
* If the extension is "pk" then a metafont pk (bitmap font) file will be import |
| 1365 |
and by default placed in the background |
| 1366 |
* Otherwise if the extension is an image extension, and any loaded images will |
| 1367 |
be placed in the background. |
| 1368 |
|
| 1369 |
* If the filename contains a "*" then it should be a recognized template in |
| 1370 |
which case all images which match that template will be loaded appropriately |
| 1371 |
and stored in the background |
| 1372 |
* Otherwise there may be several filenames (separated by semicolons), the first |
| 1373 |
will be placed in the background of the first selected glyph, the second into |
| 1374 |
the background of the second selected glyph, ... |
| 1375 |
* If the extension is "eps" then an encapsulated postscript file will be merged |
| 1376 |
into the foreground. The file may be specified as for images (except the |
| 1377 |
extension should be "eps" rather than an image extension). FontForge is |
| 1378 |
limited in its ability to read eps files. |
| 1379 |
* If the extension is "svg" then an svg file will be read into the foreground. |
| 1380 |
|
| 1381 |
If present the second argument must be an integer, if the first argument is a |
| 1382 |
bitmap font then the second argument controls whether it is imported into the |
| 1383 |
bitmap list (0) or to fill up the backgrounds of glyphs (1). For eps and svg |
| 1384 |
files this argument controls whether the splines are added to the foreground |
| 1385 |
or the background layer of the glyph. |
| 1386 |
|
| 1387 |
If there is a third argument it must also be an integer and provides a set of |
| 1388 |
flags: |
| 1389 |
|
| 1390 |
* 4 => Attempt to handle PostScript erasers (stroking with a white pen) |
| 1391 |
* 8 => Correct direction (PostScript) |
| 1392 |
* 16 => Remove anything currently present (works for SVG & EPS) |
| 1393 |
* 64 => Don't scale images and SVGs to ascender height |
| 1394 |
* 128 => Don't simplify the output of stroked paths |
| 1395 |
* 256 => Use current Import dialog settings (other flags are ignored) |
| 1396 |
* 512 => Present Import options dialog (if UI is enabled) |
| 1397 |
|
| 1398 |
When present the optional fourth argument must be a number; it overrides |
| 1399 |
the default miterlimit for PostScript (normally 10.0) and SVG (normally |
| 1400 |
4.0) stroked paths. |
| 1401 |
|
| 1402 |
Similarly, the optional fifth argument must be a number and sets the |
| 1403 |
accuracy, in em-units, of stroked and simplified paths. |
| 1404 |
|
| 1405 |
.. 32 => Don't attempt to handle SVG clip-paths |
| 1406 |
|
| 1407 |
.. function:: InFont(arg) |
| 1408 |
|
| 1409 |
Returns whether the argument is in the font. The argument may be an integer |
| 1410 |
in which case true is returned if the value is >= 0 and < total number of |
| 1411 |
glyphs in the font. Otherwise if the argument is a unicode code point or a |
| 1412 |
postscript glyph name, true is returned if that glyph is in the font. |
| 1413 |
|
| 1414 |
.. function:: Inline(width,gap) |
| 1415 |
|
| 1416 |
Produces an outline as in :func:`Outline()`, and then shrinks the glyph so |
| 1417 |
that it fits inside the outline. In other words, it produces an inlined glyph. |
| 1418 |
|
| 1419 |
.. function:: Int(real) |
| 1420 |
|
| 1421 |
Uses standard C conversion from real to integer. It can execute with no |
| 1422 |
current font. |
| 1423 |
|
| 1424 |
See Also :func:`Ceil()`, :func:`Round()` and :func:`Floor()`. |
| 1425 |
|
| 1426 |
.. function:: InterpolateFonts(percentage,other-font-name[,flags]) |
| 1427 |
|
| 1428 |
Interpolates a font which is percentage of the way from the current font to |
| 1429 |
the one specified by other-font-name (note: percentage may be negative or |
| 1430 |
more than 100, in which case we extrapolate a font). This command changes the |
| 1431 |
current font to be the new font. |
| 1432 |
|
| 1433 |
.. note:: |
| 1434 |
|
| 1435 |
You will need to set the fontname of this new font. The flag argument is |
| 1436 |
the same as for Open. |
| 1437 |
|
| 1438 |
.. function:: IsAlNum(val) |
| 1439 |
|
| 1440 |
Returns whether val is an alpha-numberic character. Val may be either an |
| 1441 |
integer, a unicode or a string. The first two cases are treated as unicode |
| 1442 |
code points, the third looks at the first (utf8) character in the string. It |
| 1443 |
can execute with no current font. |
| 1444 |
|
| 1445 |
.. function:: IsAlpha(val) |
| 1446 |
|
| 1447 |
Returns whether val is an alphabetic character. Val may be either an integer, |
| 1448 |
a unicode or a string. The first two cases are treated as unicode code |
| 1449 |
points, the third looks at the first (utf8) character in the string. It can |
| 1450 |
execute with no current font. |
| 1451 |
|
| 1452 |
.. function:: IsDigit(val) |
| 1453 |
|
| 1454 |
Returns whether val is a digit. Val may be either an integer, a unicode or a |
| 1455 |
string. The first two cases are treated as unicode code points, the third |
| 1456 |
looks at the first (utf8) character in the string. It can execute with no |
| 1457 |
current font. |
| 1458 |
|
| 1459 |
.. function:: IsFinite(real) |
| 1460 |
|
| 1461 |
Returns whether the value is finite (not infinite and not a nan). It can |
| 1462 |
execute with no current font. |
| 1463 |
|
| 1464 |
.. function:: IsHexDigit(val) |
| 1465 |
|
| 1466 |
Returns whether val is a hex-digit. Val may be either an integer, a unicode |
| 1467 |
or a string. The first two cases are treated as unicode code points, the |
| 1468 |
third looks at the first (utf8) character in the string. It can execute with |
| 1469 |
no current font. |
| 1470 |
|
| 1471 |
.. function:: IsLower(val) |
| 1472 |
|
| 1473 |
Returns whether val is a lower case letter. Val may be either an integer, a |
| 1474 |
unicode or a string. The first two cases are treated as unicode code points, |
| 1475 |
the third looks at the first (utf8) character in the string. It can execute |
| 1476 |
with no current font. |
| 1477 |
|
| 1478 |
.. function:: IsNan(real) |
| 1479 |
|
| 1480 |
Returns whether the value is a nan. It can execute with no current font. |
| 1481 |
|
| 1482 |
.. function:: IsSpace(val) |
| 1483 |
|
| 1484 |
Returns whether val is a space. Val may be either an integer, a |
| 1485 |
unicode or a string. The first two cases are treated as unicode code points, |
| 1486 |
the third looks at the first (utf8) character in the string. It can execute |
| 1487 |
with no current font. |
| 1488 |
|
| 1489 |
.. function:: IsUpper(val) |
| 1490 |
|
| 1491 |
Returns whether val is an upper case letter. Val may be either an integer, a |
| 1492 |
unicode or a string. The first two cases are treated as unicode code points, |
| 1493 |
the third looks at the first (utf8) character in the string. It can execute |
| 1494 |
with no current font. |
| 1495 |
|
| 1496 |
.. function:: Italic([angle[,[xscale[,flags[,serif[,bearings[,stems[,counters[,lcstems[,lccounters]]]]]]]]]]) |
| 1497 |
|
| 1498 |
Converts the selected glyphs to italics, similar to the |
| 1499 |
:ref:`Italic <elementmenu.Italic>` menu command. |
| 1500 |
|
| 1501 |
The following optional arguments are accepted: |
| 1502 |
|
| 1503 |
.. object:: angle |
| 1504 |
|
| 1505 |
Glyphs are slanted by the given angle in degrees. If unspecified, defaults |
| 1506 |
to -13. |
| 1507 |
|
| 1508 |
.. object:: xscale |
| 1509 |
|
| 1510 |
Points at the x-height of the font are scaled by this factor. |
| 1511 |
|
| 1512 |
.. object:: flags |
| 1513 |
|
| 1514 |
Flags controlling various italic features, composed of the following bit |
| 1515 |
values: |
| 1516 |
|
| 1517 |
0x0001 |
| 1518 |
Transform bottom serifs |
| 1519 |
0x0002 |
| 1520 |
Transform serifs at x-height |
| 1521 |
0x0004 |
| 1522 |
Transform serifs on ascenders |
| 1523 |
0x0008 |
| 1524 |
Transform diagonal serifs |
| 1525 |
0x0010 |
| 1526 |
Create italic *a* from the bottom half of italic *d* |
| 1527 |
0x0020 |
| 1528 |
Give italic *f* a long tail |
| 1529 |
0x0040 |
| 1530 |
Give italic *f* a hooked tail |
| 1531 |
0x0080 |
| 1532 |
Remove serifs from descenders |
| 1533 |
0x0100 |
| 1534 |
Special handling for Cyrillic *phi* |
| 1535 |
0x0200 |
| 1536 |
Special handling for Cyrillic *i* |
| 1537 |
0x0400 |
| 1538 |
Special handling for Cyrillic *pi* |
| 1539 |
0x0800 |
| 1540 |
Special handling for Cyrillic *te* |
| 1541 |
0x1000 |
| 1542 |
Special handling for Cyrillic *sha* |
| 1543 |
0x2000 |
| 1544 |
Special handling for Cyrillic *dje* |
| 1545 |
0x4000 |
| 1546 |
Special handling for Cyrillic *dzhe* |
| 1547 |
|
| 1548 |
.. object:: serif |
| 1549 |
|
| 1550 |
Specifies the type of italic serif: 1=flat, 2=simple slant, 3=complex |
| 1551 |
slant. Defaults to 1. |
| 1552 |
|
| 1553 |
.. object:: bearings |
| 1554 |
|
| 1555 |
Side bearings are scaled by this amount. |
| 1556 |
|
| 1557 |
.. object:: stems |
| 1558 |
|
| 1559 |
Stem widths are scaled by this amount. |
| 1560 |
|
| 1561 |
.. object:: counters |
| 1562 |
|
| 1563 |
Counters are scaled by this amount. |
| 1564 |
|
| 1565 |
.. object:: lcstems |
| 1566 |
|
| 1567 |
Stem widths of lowercase letters are scaled by this amount, overriding the |
| 1568 |
amount specified for stems, above. |
| 1569 |
|
| 1570 |
.. object:: lccounters |
| 1571 |
|
| 1572 |
Counters of lowercase letters are scaled by this amount, overriding the |
| 1573 |
amount specified for counters, above. |
| 1574 |
|
| 1575 |
.. function:: Join([fudge]) |
| 1576 |
|
| 1577 |
Joins open paths in selected glyphs. If fudge is specified then the endpoints |
| 1578 |
only need to be within fudge em-units of each other to be merged. |
| 1579 |
|
| 1580 |
.. function:: LoadEncodingFile(filename[,encname]) |
| 1581 |
|
| 1582 |
Reads an encoding file and stores it in FontForge's list of possible |
| 1583 |
encodings. See |
| 1584 |
:menuselection:`Encoding --> `:ref:`LoadEncoding <encodingmenu.Load>` for |
| 1585 |
more info. When loading encodings in Unicode consortium format an encname has |
| 1586 |
to be specified or the encoding will be ignored. |
| 1587 |
|
| 1588 |
.. function:: LoadNamelist(filename) |
| 1589 |
|
| 1590 |
Will load the namelist stored in the given file. It can execute with no |
| 1591 |
current font. |
| 1592 |
|
| 1593 |
.. function:: LoadNamelistDir([directory-name]) |
| 1594 |
|
| 1595 |
Searches the given directory for things that look like fontforge namelists |
| 1596 |
and loads them. If directory is omitted then it will load the default |
| 1597 |
directory. It can execute with no current font. |
| 1598 |
|
| 1599 |
.. function:: LoadPrefs() |
| 1600 |
|
| 1601 |
Loads the user's preferences. This used to happen automatically at startup. |
| 1602 |
Now it happens automatically when the UI is started, but scripts must |
| 1603 |
request. It can execute with no current font. it. |
| 1604 |
|
| 1605 |
.. function:: LoadStringFromFile("filename") |
| 1606 |
|
| 1607 |
Reads the entire file into a string. Returns a null string for a non-existant |
| 1608 |
or empty file. The returned string will have enough bytes allocated to hold |
| 1609 |
the entire file plus one trailing NUL byte. If the file contains a NUL |
| 1610 |
itself, fontforge will think the string ends there. It can execute with no |
| 1611 |
current font. |
| 1612 |
|
| 1613 |
.. function:: LoadTableFromFile(tag,filename) |
| 1614 |
|
| 1615 |
Both arguments should be strings, the first should be a 4 letter table tag. |
| 1616 |
The file will be read and preserved in the font as the contents of the table |
| 1617 |
with the specified tag. Don't use a tag that ff thinks it understands! |
| 1618 |
|
| 1619 |
.. function:: Log(val) |
| 1620 |
|
| 1621 |
Returns the natural log of val. It can execute with no current font. |
| 1622 |
|
| 1623 |
.. function:: LookupStoreLigatureInAfm(lookup-name,store-it) |
| 1624 |
|
| 1625 |
Sets whether the data in this ligature lookup should be stored in an afm |
| 1626 |
file. |
| 1627 |
|
| 1628 |
.. function:: LookupSetFeatureList(lookup-name,feature-script-lang-array) |
| 1629 |
|
| 1630 |
Sets the feature list of indicated lookup. The feature-script-lang array is |
| 1631 |
described at :func:`AddLookup()`. |
| 1632 |
|
| 1633 |
.. function:: MergeFonts(other-font-name[,flags]) |
| 1634 |
|
| 1635 |
Loads other-font-name, and extracts any glyphs from it which are not in the |
| 1636 |
current font and moves them to the current font. The flags argument is the |
| 1637 |
same as that for Open. Currently the only relevant flag is to say that you do |
| 1638 |
have a license to use a font with fstype=2. |
| 1639 |
|
| 1640 |
.. function:: MergeFeature(filename) |
| 1641 |
|
| 1642 |
Loads Feature and lookup info out of a feature file or kerning info from |
| 1643 |
either an afm or a tfm file and merges it into the current font. |
| 1644 |
|
| 1645 |
.. function:: MergeKern(filename) |
| 1646 |
|
| 1647 |
Deprecated name for :func:`MergeFeature()`. |
| 1648 |
|
| 1649 |
.. function:: MergeLookups(lookup-name1,lookup-name2) |
| 1650 |
|
| 1651 |
The lookups must be of the same type. All subtables from lookup-name2 will be |
| 1652 |
moved to lookup-name1, the features list of lookup-name2 will be merged with |
| 1653 |
that of lookup-name1, and lookup-name2 will be removed. |
| 1654 |
|
| 1655 |
.. function:: MergeLookupSubtables(subtable-name1,subtable-name2) |
| 1656 |
|
| 1657 |
The subtables must be in the same lookup. Not all lookup types allow their |
| 1658 |
subtables to be merged (contextual subtables may not be merged, kerning |
| 1659 |
classes may not be (kerning pairs may be)). Any information bound to |
| 1660 |
subtable2 will be bound to subtable1 and subtable2 will be removed. |
| 1661 |
|
| 1662 |
.. function:: MMAxisBounds(axis) |
| 1663 |
|
| 1664 |
Axis is an integer less than the number of axes in the mm font. Returns an |
| 1665 |
array containing the lower bound, default value and upper bound. Note each |
| 1666 |
value is multiplied by 65536 (because they need not be integers on the mac, |
| 1667 |
and ff doesn't support real values). |
| 1668 |
|
| 1669 |
(The default value is a GX Var concept. FF simulates a reasonable value for |
| 1670 |
true multiple master fonts). |
| 1671 |
|
| 1672 |
.. function:: MMAxisNames() |
| 1673 |
|
| 1674 |
Returns an array containing the names of all axes in a multi master set. |
| 1675 |
|
| 1676 |
.. function:: MMBlendToNewFont(weights) |
| 1677 |
|
| 1678 |
Weights is an array of integers, one for each axis. Each value should be |
| 1679 |
65536 times the desired value (to deal with mac blends which tend to be small |
| 1680 |
real numbers). This command creates a completely new font by blending the mm |
| 1681 |
font and sets the current font to the new font. |
| 1682 |
|
| 1683 |
.. function:: MMChangeInstance(instance) |
| 1684 |
|
| 1685 |
Where instance is either a font name or a small integer. If passed a string |
| 1686 |
FontForge searches through all fonts in the multi master font set (instance |
| 1687 |
fonts and the weighted font) and changes the current font to the indicated |
| 1688 |
one. If passed a small integer, then -1 indicates the weighted font and |
| 1689 |
values between [0,$mmcount) represent that specific instance in the font set. |
| 1690 |
|
| 1691 |
.. function:: MMChangeWeight(weights) |
| 1692 |
|
| 1693 |
Weights is an array of integers, one for each axis. Each value should be |
| 1694 |
65536 times the desired value (to deal with mac blends which tend to be small |
| 1695 |
real numbers). This command changes the current multiple master font to have |
| 1696 |
a different default weight, and sets that to be the current instance. |
| 1697 |
|
| 1698 |
.. function:: MMInstanceNames() |
| 1699 |
|
| 1700 |
Returns an array containing the names of all instance fonts in a multi master |
| 1701 |
set. |
| 1702 |
|
| 1703 |
.. function:: MMWeightedName() |
| 1704 |
|
| 1705 |
Returns the name of the weighted font in a multi master set. |
| 1706 |
|
| 1707 |
.. function:: Move(delta-x,delta-y) |
| 1708 |
|
| 1709 |
All selected glyphs will have their points moved the given amount. |
| 1710 |
|
| 1711 |
.. function:: MoveReference(delta-x,delta-y,[refname/ref-unicode]+) |
| 1712 |
|
| 1713 |
References may be identified either by a string containing the name of the |
| 1714 |
glyph being referred to, or an integer containing the unicode code point of |
| 1715 |
the glyph being referred to, there may be an arbetrary (positive) number of |
| 1716 |
references specified. Each selected glyph will be searched for references |
| 1717 |
that match the name/unicode-values given, all references found will be moved |
| 1718 |
by the specified offsets. |
| 1719 |
|
| 1720 |
Example: |
| 1721 |
|
| 1722 |
:: |
| 1723 |
|
| 1724 |
MoveReference(300,0,"acute",0xb4) |
| 1725 |
|
| 1726 |
Will move any acute or grave references 300 em-units horizontally from where |
| 1727 |
they currently are |
| 1728 |
|
| 1729 |
.. function:: MultipleEncodingsToReferences() |
| 1730 |
|
| 1731 |
If any selected glyphs have multiple encodings then one of these encodings |
| 1732 |
will be chosen as the real one. For each of the others a new glyph will be |
| 1733 |
created containing a reference to the base glyph. This sort of undoes the |
| 1734 |
effect of :func:`SameGlyphAs()`. |
| 1735 |
|
| 1736 |
MetaData, such as advanced typographic features, are not copied. |
| 1737 |
|
| 1738 |
.. function:: NearlyHvCps([error[,err-denom]]) |
| 1739 |
|
| 1740 |
Checks for control points which are almost, but not quite horizontal or |
| 1741 |
vertical (where almost means (say) that |
| 1742 |
``abs( (control point).x - point.x ) < error``, where error is either: |
| 1743 |
|
| 1744 |
.1 |
| 1745 |
if no arguments are given |
| 1746 |
first-arg |
| 1747 |
if one argument is given |
| 1748 |
first-arg/second-arg |
| 1749 |
if two arguments are given |
| 1750 |
|
| 1751 |
.. function:: NearlyHvLines([error[,err-denom]]) |
| 1752 |
|
| 1753 |
Checks for lines which are almost, but not quite horizontal or vertical (where |
| 1754 |
almost means (say) that ``abs( (end point).x - (start point).x ) < error``, |
| 1755 |
where error is either: |
| 1756 |
|
| 1757 |
.1 |
| 1758 |
if no arguments are given |
| 1759 |
first-arg |
| 1760 |
if one argument is given |
| 1761 |
first-arg/second-arg |
| 1762 |
if two arguments are given |
| 1763 |
|
| 1764 |
.. function:: NearlyLines(error) |
| 1765 |
|
| 1766 |
Checks for splines that are nearly linear, and makes them so. A spline is |
| 1767 |
nearly linear if the maximum deviation of the spline from the line between |
| 1768 |
the spline's endpoints is less than error. |
| 1769 |
|
| 1770 |
.. function:: NameFromUnicode(uni[,namelist]) |
| 1771 |
|
| 1772 |
Returns a glyph name given a unicode code point. If a namelist is specified |
| 1773 |
then the name will come from it. It can execute with no current font. |
| 1774 |
|
| 1775 |
.. function:: New() |
| 1776 |
|
| 1777 |
This creates a new font. It can execute with no current font. |
| 1778 |
|
| 1779 |
.. function:: NonLinearTransform(x-expression,y-expression) |
| 1780 |
|
| 1781 |
Takes two string arguments which must contain valid expressions of x and y |
| 1782 |
and transforms all selected glyphs using those expressions. |
| 1783 |
|
| 1784 |
:: |
| 1785 |
|
| 1786 |
<e0> := "x" | "y" | "-" <e0> | "!" <e0> | "(" <expr> ")" | |
| 1787 |
"sin" "(" <expr> ")" | "cos" "(" <expr> ")" | "tan" "(" <expr> ")" | |
| 1788 |
"log" "(" <expr> ")" | "exp" "(" <expr> ")" | "sqrt" "(" <expr> ")" | |
| 1789 |
"abs" "(" <expr> ")" | |
| 1790 |
"rint" "(" <expr> ")" | "float" "(" <expr> ")" | "ceil" "(" <expr> ")" |
| 1791 |
<e1> := <e0> "^" <e1> |
| 1792 |
<e2> := <e1> "*" <e2> | <e1> "/" <e2> | <e1> "%" <e2> |
| 1793 |
<e3> := <e2> "+" <e3> | <e2> "-" <e3> |
| 1794 |
<e4> := <e3> "==" <e4> | <e3> "!=" <e4> | |
| 1795 |
<e3> ">=" <e4> | <e3> ">" <e4> | |
| 1796 |
<e3> "<=" <e4> | <e3> "<" <e4> |
| 1797 |
<e5> := <e4> "&&" <e5> | <e4> "||" <e5> |
| 1798 |
<expr> := <e5> "?" <expr> ":" |
| 1799 |
|
| 1800 |
Example: To do a perspective transformation with a vanishing point at |
| 1801 |
(200,300): |
| 1802 |
|
| 1803 |
:: |
| 1804 |
|
| 1805 |
NonLinearTrans("200+(x-200)*abs(y-300)/300","y") |
| 1806 |
|
| 1807 |
This command is not available in the default build, you must modify the file |
| 1808 |
``configure-fontforge.h`` and then rebuild FontForge. |
| 1809 |
|
| 1810 |
.. function:: Open(filename[,flags]) |
| 1811 |
|
| 1812 |
This makes the font named by filename be the current font. If filename has |
| 1813 |
not yet been loaded into memory it will be loaded now. It can execute without |
| 1814 |
a current font. |
| 1815 |
|
| 1816 |
When loading from a ttc file (mac suitcase, dfont, svg, etc), a particular |
| 1817 |
font may be selected by placing the fontname in parens and appending it to |
| 1818 |
the filename, as ``Open("gulim.ttc(Dotum)")``. If you know the font's index |
| 1819 |
you may also say: ``Open("gulim.ttc(0)")``. |
| 1820 |
|
| 1821 |
The optional flags argument current has only two flags in it: |
| 1822 |
|
| 1823 |
* 1 => the user does have the appropriate license to examine the font no matter |
| 1824 |
what the fstype setting is. |
| 1825 |
* 4 => load all glyphs from the 'glyf' table of a ttc font (rather than only |
| 1826 |
the glyphs used in the font picked). |
| 1827 |
* 8 => Report more error conditions |
| 1828 |
* 16 => Do not create a view window for this font even if the UI is active. |
| 1829 |
|
| 1830 |
.. note:: |
| 1831 |
|
| 1832 |
This option supports efficient bulk processing of fonts in scripts |
| 1833 |
run through the UI but using it can be tricky. Open fonts will be listed |
| 1834 |
at the bottom of the "Window" menu but choosing them will have no effect. |
| 1835 |
|
| 1836 |
If some fonts are not closed you may need to "force-quit" the |
| 1837 |
application using your OS. |
| 1838 |
* 32 => Retain all recognized font tables that do not have a native format |
| 1839 |
|
| 1840 |
.. function:: Ord(string[,pos]) |
| 1841 |
|
| 1842 |
Returns an array of integers representing the bytes in the string. If pos is |
| 1843 |
given it should be an integer less than the string length and the function |
| 1844 |
will return the integer representing that byte in the string. It can execute |
| 1845 |
with no current font. |
| 1846 |
|
| 1847 |
.. function:: Outline(width) |
| 1848 |
|
| 1849 |
Strokes all selected glyphs with a stroke of the specified width (internal to |
| 1850 |
the glyphs). The bounding box of the glyph will not change. In other words it |
| 1851 |
produces what the mac calls the "Outline Style". |
| 1852 |
|
| 1853 |
.. function:: OverlapIntersect() |
| 1854 |
|
| 1855 |
Removes everything but the intersection. |
| 1856 |
|
| 1857 |
.. function:: Paste Into |
| 1858 |
|
| 1859 |
Copies the clipboard into the current font (merging with what was there |
| 1860 |
before) |
| 1861 |
|
| 1862 |
.. function:: Paste |
| 1863 |
|
| 1864 |
Copies the clipboard into the selected glyphs of the current font (removing |
| 1865 |
what was there before) |
| 1866 |
|
| 1867 |
.. function:: PasteWithOffset(xoff,yoff) |
| 1868 |
|
| 1869 |
Translates the clipboard by xoff,yoff before doing a PasteInto(). Can be used |
| 1870 |
to build accented glyphs. |
| 1871 |
|
| 1872 |
.. function:: PositionReference(x,y,[refname/ref-unicode]+) |
| 1873 |
|
| 1874 |
References may be identified either by a string containing the name of the |
| 1875 |
glyph being referred to, or an integer containing the unicode code point of |
| 1876 |
the glyph being referred to, there may be an arbetrary (positive) number of |
| 1877 |
references specified. Each selected glyph will be searched for references |
| 1878 |
that match the name/unicode-values given, all references found will be at the |
| 1879 |
specified location. |
| 1880 |
|
| 1881 |
Example: |
| 1882 |
|
| 1883 |
:: |
| 1884 |
|
| 1885 |
PositionReference(0,0,"circumflex") |
| 1886 |
|
| 1887 |
Will position any references to circumflex so that they are where the base |
| 1888 |
circumflex is |
| 1889 |
|
| 1890 |
.. function:: PostNotice(str) |
| 1891 |
|
| 1892 |
When run from the UI will put up a window displaying the string (the window |
| 1893 |
will not block the program and will disappear after a minute or so). When run |
| 1894 |
from the command line will write the string to stderr. It can execute with no |
| 1895 |
current font. |
| 1896 |
|
| 1897 |
.. function:: Pow(val1,val2) |
| 1898 |
|
| 1899 |
Returns val1:sup:`val2`. It can execute with no current font. |
| 1900 |
|
| 1901 |
.. function:: PreloadCidmap(filename,registry,ordering,supplement) |
| 1902 |
|
| 1903 |
Loads a user defined cidmap file for the specified ROS. All arguments except |
| 1904 |
the last should be strings while supplement should be an integer. This can |
| 1905 |
execute without a font loaded. |
| 1906 |
|
| 1907 |
.. function:: Print(arg1,arg2,arg3,...) |
| 1908 |
|
| 1909 |
This corresponds to no menu item. It will print all of its arguments to |
| 1910 |
stdout. It can execute with no current font. |
| 1911 |
|
| 1912 |
.. function:: PrintFont(type[,pointsize[,sample-text/filename[,output-file]]]) |
| 1913 |
|
| 1914 |
Prints the current font according to the :func:`PrintSetup()`. The values |
| 1915 |
for type are (meanings are described in the :doc:`section on printing </ui/dialogs/display>`): |
| 1916 |
|
| 1917 |
* 0 => Prints a full font display at the given pointsize |
| 1918 |
* 1 => Prints selected glyphs to fill page |
| 1919 |
* 2 => Prints selected glyphs at multiple pointsizes |
| 1920 |
* 3 => Prints a text sample read from a file at the given pointsize(s) |
| 1921 |
* 4 => Prints a text sample, except that instead of treating the third argument |
| 1922 |
as a file name it represents the sample itself (in utf-8 encoding) |
| 1923 |
|
| 1924 |
The pointsize is either a single integer or an array of integers. It is only |
| 1925 |
meaningful for types 0, 3 and 4. If omitted or set to 0 a default value will |
| 1926 |
be chosen. The font display will only look at one value. |
| 1927 |
|
| 1928 |
If you selected print type 3 then you may provide the name of a file |
| 1929 |
containing sample text. This file may either be in ucs2 format (preceded by a |
| 1930 |
0xfeff value), or in the current default encoding. A null string or an |
| 1931 |
omitted argument will cause FontForge to use a default value. |
| 1932 |
|
| 1933 |
If your PrintSetup specified printing to a file (either PostScript or pdf) |
| 1934 |
then the fourth argument provides the filename of the output file. |
| 1935 |
|
| 1936 |
.. function:: PrintSetup(type,[printer[,width,height]]) |
| 1937 |
|
| 1938 |
Allows you to configure the print command. Type may be a value between 0 and |
| 1939 |
4 |
| 1940 |
|
| 1941 |
* 0 => print with lp |
| 1942 |
* 1 => print with lpr |
| 1943 |
* 2 => output to ghostview |
| 1944 |
* 3 => output to PostScript file |
| 1945 |
* 4 => other printing command |
| 1946 |
* 5 => output to a pdf file |
| 1947 |
|
| 1948 |
If the type is 4 (other) and the second argument is specified, then the |
| 1949 |
second argument should be a string containing the "other" printing command. |
| 1950 |
|
| 1951 |
If the type is 0 (lp) or 1 (lpr) and the second argument is specified, then |
| 1952 |
the second argument should contain the name of a laser printer |
| 1953 |
|
| 1954 |
(If the second argument is a null string neither will be set). |
| 1955 |
|
| 1956 |
The third and fourth arguments should specify the page width and height |
| 1957 |
respectively. Units are in 1/72 inches (almost points), so 8.5x11" paper is |
| 1958 |
612,792 and A4 paper is (about) 595,842. |
| 1959 |
|
| 1960 |
.. function:: PrivateGuess(key) |
| 1961 |
|
| 1962 |
key should be a string containing the name of a standard thing in the PS |
| 1963 |
Private dictionary that fontforge can guess a value for. "BlueValues" for |
| 1964 |
example. |
| 1965 |
|
| 1966 |
.. function:: Quit(status) |
| 1967 |
|
| 1968 |
Causes FontForge to exit with the given status (no attempt is made to save |
| 1969 |
unsaved files). This command can execute with no current font. |
| 1970 |
|
| 1971 |
.. function:: Rand() |
| 1972 |
|
| 1973 |
returns a random integer. It can execute with no current font. |
| 1974 |
|
| 1975 |
.. function:: ReadOtherSubrsFile(filename) |
| 1976 |
|
| 1977 |
Reads new PostScript subroutines to be used in the OtherSubrs array of a |
| 1978 |
type1 font. The file format is a little more complicated than it should be |
| 1979 |
(because I can't figure out how to parse the OtherSubrs array into individual |
| 1980 |
subroutines). |
| 1981 |
|
| 1982 |
* The subroutine list should not be enclosed in a [ ] pair |
| 1983 |
* Each subroutine should be preceded by a line starting with '%%%%' (there may |
| 1984 |
be more stuff after that) |
| 1985 |
* Subroutines should come in the obvious order, and must have the expected |
| 1986 |
meaning. |
| 1987 |
* If you don't wish to support flex hints set the first three subroutines to |
| 1988 |
"{}" |
| 1989 |
* You may specify at most 14 subroutines (0-13) |
| 1990 |
* Any text before the first subroutine will be treated as a copyright notice. |
| 1991 |
|
| 1992 |
:: |
| 1993 |
|
| 1994 |
% Copyright (c) 1987-1990 Adobe Systems Incorporated. |
| 1995 |
% All Rights Reserved |
| 1996 |
% This code to be used for Flex and Hint Replacement |
| 1997 |
% Version 1.1 |
| 1998 |
%%%%%% |
| 1999 |
{systemdict /internaldict known |
| 2000 |
1183615869 systemdict /internaldict get exec |
| 2001 |
... |
| 2002 |
%%%%%% |
| 2003 |
{gsave currentpoint newpath moveto} executeonly |
| 2004 |
%%%%%% |
| 2005 |
{currentpoint grestore gsave currentpoint newpath moveto} executeonly |
| 2006 |
%%%%%% |
| 2007 |
{systemdict /internaldict known not |
| 2008 |
{pop 3} |
| 2009 |
... |
| 2010 |
|
| 2011 |
It can execute with no current font. |
| 2012 |
|
| 2013 |
.. function:: Real(int) |
| 2014 |
|
| 2015 |
Converts an integer to a real number. It can execute with no current font. |
| 2016 |
|
| 2017 |
.. function:: Reencode(encoding-name[,force]) |
| 2018 |
|
| 2019 |
Reencodes the current font into the given encoding which may be: |
| 2020 |
|
| 2021 |
compacted,original, |
| 2022 |
|
| 2023 |
iso8859-1, isolatin1, latin1, iso8859-2, latin2, iso8859-3, latin3, |
| 2024 |
iso8859-4, latin4, iso8859-5, iso8859-6, iso8859-7, iso8859-8, iso8859-9, |
| 2025 |
iso8859-10, isothai, iso8859-13, iso8859-14, iso8859-15, latin0, koi8-r, |
| 2026 |
jis201, jisx0201, AdobeStandardEncoding, win, mac, symbol, wansung, big5, |
| 2027 |
johab, jis208, jisx0208, jis212, jisx0212, sjis, gh2312, gb2312packed, |
| 2028 |
unicode, iso10646-1, unicode4, TeX-Base-Encoding, one of the user defined |
| 2029 |
encodings. |
| 2030 |
|
| 2031 |
You may also specify that you want to force the encoding to be the given one. |
| 2032 |
|
| 2033 |
.. note:: |
| 2034 |
|
| 2035 |
Some encodings are specified by glyph names (ie. user defined encodings |
| 2036 |
specified as postscript encoding arrays) others are specified as lists of |
| 2037 |
unicode code points (most built in encodings except for AdobeStandard and |
| 2038 |
TeX, user defined encodings specified by codepoints). |
| 2039 |
|
| 2040 |
If you reencode to an encoding defined by glyph names, then ff will first |
| 2041 |
move glyphs to the appropriate slots, and then force any glyphs with the |
| 2042 |
wrong name to have the correct one. |
| 2043 |
|
| 2044 |
The most obvious example of this is the fi ligature: |
| 2045 |
AdobeStandard says it should be named "fi", modern fonts tend to call it |
| 2046 |
"f_i". Reencoding to AdobeStandard will move this glyph to the right slot, |
| 2047 |
and then name it "fi". |
| 2048 |
|
| 2049 |
.. function:: RemoveAllKerns() |
| 2050 |
|
| 2051 |
Removes all kern pairs and classes from the current font. |
| 2052 |
|
| 2053 |
.. function:: RemoveAllVKerns() |
| 2054 |
|
| 2055 |
Removes all vertical kern pairs and classes from the current font. |
| 2056 |
|
| 2057 |
.. function:: RemoveAnchorClass(name) |
| 2058 |
|
| 2059 |
Removes the named AnchorClass (and all associated points) from the font. |
| 2060 |
|
| 2061 |
.. function:: RemoveLookup(lookup-name[,remove_acs]) |
| 2062 |
|
| 2063 |
Remove the lookup (and any subtables within it). remove_acs specifies to |
| 2064 |
remove associated anchor classes and points. |
| 2065 |
|
| 2066 |
.. function:: RemoveLookupSubtable(subtable-name[,remove_acs]) |
| 2067 |
|
| 2068 |
Remove the subtable. remove_acs specifies to remove associated anchor classes |
| 2069 |
and points. |
| 2070 |
|
| 2071 |
.. function:: RemovePosSub(subtable-name) |
| 2072 |
|
| 2073 |
Remove any positionings or substitutions from the selected glyphs that are |
| 2074 |
controlled by the named subtable. If the subtable name is "*" then all are |
| 2075 |
removed. |
| 2076 |
|
| 2077 |
.. function:: RemoveDetachedGlyphs() |
| 2078 |
|
| 2079 |
If this font contains any glyphs which do not have an encoding slot then |
| 2080 |
those glyphs will be removed from the font. In other words any glyph not |
| 2081 |
displayed in the fontview will be removed. |
| 2082 |
|
| 2083 |
.. function:: RemoveOverlap() |
| 2084 |
|
| 2085 |
Does the obvious. |
| 2086 |
|
| 2087 |
.. function:: RemovePreservedTable(tag) |
| 2088 |
|
| 2089 |
Searches for a preserved table with the given tag, and removes it from the |
| 2090 |
font. |
| 2091 |
|
| 2092 |
.. function:: RenameGlyphs(namelist-name) |
| 2093 |
|
| 2094 |
Renames all the glyphs in the current font according to the namelist. |
| 2095 |
|
| 2096 |
.. function:: ReplaceCharCounterMasks(array) |
| 2097 |
|
| 2098 |
Deprecated name for :func:`ReplaceGlyphCounterMasks()` |
| 2099 |
|
| 2100 |
.. function:: ReplaceGlyphCounterMasks(array) |
| 2101 |
|
| 2102 |
This requires that there be exactly one glyph selected. It will create a set |
| 2103 |
of counter masks for that glyph. The single argument must be an array of |
| 2104 |
twelve element arrays of integers (in c this would be "int array[][12]"). |
| 2105 |
This is the format of a type2 counter mask. The number of elements in the top |
| 2106 |
level array is the number of counter groups to be specified. The nested array |
| 2107 |
thus corresponds to a counter mask, and is treated as an array of bytes. Each |
| 2108 |
bit in the byte specifies whether the corresponding hint is active in this |
| 2109 |
counter. (there are at most 96 hints, so at most 12 bytes). Array[i][0]&0x80 |
| 2110 |
corresponds to the first horizontal stem hint, Array[i][0]&0x40 corresponds |
| 2111 |
to the second, Array[i][1]&0x80 corresponds to the eighth hint, etc. |
| 2112 |
|
| 2113 |
.. function:: ReplaceCvtAt(index,value) |
| 2114 |
|
| 2115 |
Change the cvt table at the given index to have the new value. |
| 2116 |
|
| 2117 |
.. function:: ReplaceWithReference([fudge]) |
| 2118 |
|
| 2119 |
Finds any glyph which contains an inline copy of one of the selected glyphs, |
| 2120 |
and converts that copy into a reference to the appropriate glyph. Selection |
| 2121 |
is changed to the set of glyphs which the command alters. |
| 2122 |
|
| 2123 |
If specified the fudge argument specifies the error allowed for coordinate |
| 2124 |
differences. The fudge argument may be either a real number or two integers |
| 2125 |
where the first specifies the numerator and the second the denominator of the |
| 2126 |
fudge (=arg1/arg2). Left over from the days when ff did not support real |
| 2127 |
numbers. |
| 2128 |
|
| 2129 |
.. function:: Revert() |
| 2130 |
|
| 2131 |
Reverts the current font to the last version. |
| 2132 |
|
| 2133 |
.. function:: RevertToBackup() |
| 2134 |
|
| 2135 |
Reverts the current font to a backup sfd file (if any) |
| 2136 |
|
| 2137 |
.. function:: Rotate(angle[,ox,oy]) |
| 2138 |
|
| 2139 |
Rotates all selected glyph the specified number of degrees. If the last two |
| 2140 |
args are specified they provide the origin of the rotation, otherwise the |
| 2141 |
center of the glyph is used. |
| 2142 |
|
| 2143 |
.. function:: Round(real) |
| 2144 |
|
| 2145 |
Converts a real number to an integer by rounding to the nearest integer. It |
| 2146 |
can execute with no current font. |
| 2147 |
|
| 2148 |
See Also :func:`Ceil()`, :func:`Int()` and :func:`Floor()`. |
| 2149 |
|
| 2150 |
.. function:: RoundToCluster([within[,max]]) |
| 2151 |
|
| 2152 |
The first two provide a fraction that indicates a value within which similar |
| 2153 |
coordinates will be bundled together. Max indicates how many "within"s from |
| 2154 |
the center point it will go if there are a chain of points each within |
| 2155 |
"within" of the previous one. So |
| 2156 |
|
| 2157 |
:: |
| 2158 |
|
| 2159 |
RoundToCluster(.1,.5) |
| 2160 |
|
| 2161 |
Will merge coordinates within .1 em-unit of each other. A sequence like |
| 2162 |
``-.1,-.05,0,.05,.1,.15`` will all be merged together because each is within |
| 2163 |
.1 of the next, and none is more than .5 from the center. |
| 2164 |
|
| 2165 |
.. function:: RoundToInt([factor]) |
| 2166 |
|
| 2167 |
Rounds all points/hints/reference-offsets to be integers. If the "factor" |
| 2168 |
argument is specified then it rounds like ``rint(factor * x) / factor``, in |
| 2169 |
other words if you set factor to 100 then it will round to hundredths. |
| 2170 |
|
| 2171 |
.. function:: SameGlyphAs |
| 2172 |
|
| 2173 |
If the clipboard contains a reference to a single glyph then this makes all |
| 2174 |
selected glyphs refer to that one. |
| 2175 |
|
| 2176 |
Adobe suggests that you avoid this. Use a reference instead. In some |
| 2177 |
situations (I think pdf files is one) having one glyph with several encodings |
| 2178 |
causes problems (Acrobat uses the glyph to back-map through the encoding to |
| 2179 |
work out the unicode code point. But that will fail if a glyph has two |
| 2180 |
unicode code points associated with it). |
| 2181 |
|
| 2182 |
.. function:: Save([filename]) |
| 2183 |
|
| 2184 |
If no filename is specified then this saves the current font back into its |
| 2185 |
sfd file (if the font has no sfd file then this is an error). With one |
| 2186 |
argument it executes a SaveAs command, saving the current font to that |
| 2187 |
filename. |
| 2188 |
|
| 2189 |
If the filename has an extension ".sfdir" then the font will be saved into a |
| 2190 |
SplineFont Directory. |
| 2191 |
|
| 2192 |
.. function:: SavePrefs() |
| 2193 |
|
| 2194 |
Save the current state of preferences. This used to happen when SetPref was |
| 2195 |
called, now a script must request it explicitly. It can execute with no |
| 2196 |
current font. |
| 2197 |
|
| 2198 |
.. function:: SaveTableToFile(tag,filename) |
| 2199 |
|
| 2200 |
Both arguments should be strings, the first should be a 4 letter table tag. |
| 2201 |
The list of preserved tables will be searched for a table with the given tag, |
| 2202 |
and saved to the file. |
| 2203 |
|
| 2204 |
.. function:: Scale(factor[,yfactor][,ox,oy]) |
| 2205 |
|
| 2206 |
All selected glyphs will be scaled (scale factors are in percent) |
| 2207 |
|
| 2208 |
* with one argument they will be scaled uniformly about the glyph's center |
| 2209 |
point |
| 2210 |
* with two arguments the first specifies the scale factor for x, the second for |
| 2211 |
y. Again scaling will be about the center point |
| 2212 |
* with three arguments they will be scaled uniformly about the specified center |
| 2213 |
* with four arguments they will be scaled differently about the specified |
| 2214 |
center |
| 2215 |
|
| 2216 |
.. function:: ScaleToEm(em-size) |
| 2217 |
ScaleToEm(ascent,descent) |
| 2218 |
|
| 2219 |
Change the font's ascent and descent and scale everything in the font to be |
| 2220 |
in the same proportion to the new em (which is the sum of ascent and descent) |
| 2221 |
value that it was to the old value. |
| 2222 |
|
| 2223 |
.. function:: Select(arg1, arg2, ...) |
| 2224 |
|
| 2225 |
This clears out the current selection, then for each pair of arguments it |
| 2226 |
selects all glyphs between (inclusive) the bounds specified by the pair. If |
| 2227 |
there is a final singleton argument then that single glyph will be selected. |
| 2228 |
An argument may be specified by: |
| 2229 |
|
| 2230 |
* an integer which specifies the location in the current font's encoding |
| 2231 |
* a postscript unicode name which gets mapped into the current font's encoding |
| 2232 |
* a unicode code point (0u61) which gets mapped to the current font's encoding |
| 2233 |
* If Select is given exactly one argument and that argument is an array then |
| 2234 |
the selection will be set to that specified in the array. So array[0] would |
| 2235 |
set the selection of the glyph at encoding 0 and so forth. The array may have |
| 2236 |
a different number of elements from that number of glyphs in the font but |
| 2237 |
should otherwise be in the same format as that returned by the $selection |
| 2238 |
pseudo-variable. |
| 2239 |
|
| 2240 |
.. function:: SelectAll |
| 2241 |
|
| 2242 |
Selects all glyphs |
| 2243 |
|
| 2244 |
.. function:: SelectAllInstancesOf(name1[,...]) |
| 2245 |
|
| 2246 |
A glyph may be mapped to more than one encoding slot. This will select all |
| 2247 |
encoding slots which refer to the named glyph(s). The name may be either a |
| 2248 |
string containing a glyph name, or a unicode code point. |
| 2249 |
|
| 2250 |
.. function:: SelectBitmap(size) |
| 2251 |
|
| 2252 |
In a bitmap only font this selects which bitmap strike will be used for units |
| 2253 |
in the following metrics commands. If no bitmap is selected, then the units |
| 2254 |
should be in em-units, otherwise units will be in pixels of the given bitmap |
| 2255 |
strike. The size should be the pixelsize of the font. If you use anti-aliased |
| 2256 |
fonts then size should be set to (depth<<16)|pixel_size. A value of -1 for |
| 2257 |
size deselects all bitmaps (units become em-units). |
| 2258 |
|
| 2259 |
.. function:: SelectByPosSub(lookup-subtable-name,search_type) |
| 2260 |
|
| 2261 |
Selects all glyphs affected by the lookup subtable. |
| 2262 |
|
| 2263 |
And for search_type |
| 2264 |
|
| 2265 |
#. Select Results |
| 2266 |
#. Merge Selection |
| 2267 |
#. Restrict Selection |
| 2268 |
|
| 2269 |
.. function:: SelectChanged([merge]) |
| 2270 |
|
| 2271 |
Selects all changed glyphs. If merge is true, will or the current selection |
| 2272 |
with the new one. |
| 2273 |
|
| 2274 |
.. function:: SelectFewer(arg1, arg2, ...) |
| 2275 |
|
| 2276 |
The same as in :func:`Select()` except that it clears |
| 2277 |
the selection on the indicated glyphs, so it reduces the current selection. |
| 2278 |
|
| 2279 |
.. function:: SelectFewerSingletons(arg1, ...) |
| 2280 |
|
| 2281 |
Same as :func:`SelectSingletons()` except it removes single glyphs from the |
| 2282 |
current selection. |
| 2283 |
|
| 2284 |
.. function:: SelectGlyphsBoth() |
| 2285 |
|
| 2286 |
Selects glyphs with both references and contours. |
| 2287 |
|
| 2288 |
.. function:: SelectGlyphsReferences() |
| 2289 |
|
| 2290 |
Selects glyphs with only references. |
| 2291 |
|
| 2292 |
.. function:: SelectGlyphsSplines() |
| 2293 |
|
| 2294 |
Selects glyphs with only contours. |
| 2295 |
|
| 2296 |
.. function:: SelectHintingNeeded([merge]) |
| 2297 |
|
| 2298 |
Selects all glyphs which FontForge thinks need their hints updated. |
| 2299 |
|
| 2300 |
.. function:: SelectIf(arg1,arg2, ...) |
| 2301 |
|
| 2302 |
The same as Select() except that instead of signalling an error when a glyph |
| 2303 |
is not in the font it returns an error code. |
| 2304 |
|
| 2305 |
* 0 => there were no errors but no glyphs were selected |
| 2306 |
* <a positive number> => there were no errors and this many glyphs were |
| 2307 |
selected |
| 2308 |
* -2 => there was an error and no glyphs were selected |
| 2309 |
* -1 => there was an error and at least one glyph was selected before that. |
| 2310 |
|
| 2311 |
.. function:: SelectInvert() |
| 2312 |
|
| 2313 |
Inverts the selection. |
| 2314 |
|
| 2315 |
.. function:: SelectMore(arg1, arg2, ...) |
| 2316 |
|
| 2317 |
The same as in :func:`Select()` except that it does not clear the selection |
| 2318 |
initially, so it extends the current selection. |
| 2319 |
|
| 2320 |
.. function:: SelectMoreIf(arg1, arg2, ...) |
| 2321 |
|
| 2322 |
The same as in :func:`SelectMore()` except that it returns an error code if |
| 2323 |
one of the glyph(s) does not exist. |
| 2324 |
|
| 2325 |
.. function:: SelectMoreSingletons(arg1, ...) |
| 2326 |
|
| 2327 |
Same as :func:`SelectSingletons()` except it adds single glyphs from the |
| 2328 |
current selection. |
| 2329 |
|
| 2330 |
.. function:: SelectMoreSingletonsIf(arg1, ...) |
| 2331 |
|
| 2332 |
Same as :func:`SelectMoreSingletons()` except it returns an error code if |
| 2333 |
one of the glyph(s) does not exist. |
| 2334 |
|
| 2335 |
.. function:: SelectNone() |
| 2336 |
|
| 2337 |
Deselects all glyphs |
| 2338 |
|
| 2339 |
.. function:: SelectSingletons(arg1, ...) |
| 2340 |
|
| 2341 |
Selects its arguments without looking for ranges. |
| 2342 |
|
| 2343 |
.. function:: SelectSingletonsIf(arg1, ...) |
| 2344 |
|
| 2345 |
Selects its arguments without looking for ranges, and returns an error code |
| 2346 |
if a gyph did not exist. |
| 2347 |
|
| 2348 |
.. function:: SelectWorthOutputting() |
| 2349 |
|
| 2350 |
Selects all glyphs :func:`WorthOutputting()` |
| 2351 |
|
| 2352 |
.. function:: SetCharCnt(cnt) |
| 2353 |
|
| 2354 |
Sets the number of encoding slots in the font. |
| 2355 |
|
| 2356 |
.. function:: SetCharColor(color) |
| 2357 |
|
| 2358 |
Deprecated name for :func:`SetGlyphColor()` |
| 2359 |
|
| 2360 |
.. function:: SetCharComment(comment) |
| 2361 |
|
| 2362 |
Deprecated name for :func:`SetGlyphComment()` |
| 2363 |
|
| 2364 |
.. function:: SetCharCounterMask(cg,hint-index,hint-index,...) |
| 2365 |
|
| 2366 |
Deprecated name for :func:`SetGlyphCounterMask()` |
| 2367 |
|
| 2368 |
.. function:: SetCharName(name[,set-from-name-flag]) |
| 2369 |
|
| 2370 |
Deprecated name for :func:`SetGlyphName()` |
| 2371 |
|
| 2372 |
.. function:: SetGasp([ppem,flag[,ppem2,flag[,...]]]) |
| 2373 |
|
| 2374 |
With no arguments gives the font an empty gasp table. |
| 2375 |
|
| 2376 |
With an even number of integer arguments it sets the gasp table to the given |
| 2377 |
pixel size/flag value pairs. These must be ordered by pixel size (smallest |
| 2378 |
first) and must end with an entry for pixel size 65535. |
| 2379 |
|
| 2380 |
With exactly one argument it must be an array containing an ordered list of |
| 2381 |
pixel size/flag value pairs (as above). |
| 2382 |
|
| 2383 |
:: |
| 2384 |
|
| 2385 |
SetGasp(8,2,16,1,65535,3) |
| 2386 |
SetGasp([8,2,16,1,65535,3]) |
| 2387 |
|
| 2388 |
A flag value of 0 means neither grid-fit nor anti-alias |
| 2389 |
|
| 2390 |
A flag value of 1 means grid-fit but no anti-alias. |
| 2391 |
|
| 2392 |
A flag value of 2 means no grid-fit but anti-alias. |
| 2393 |
|
| 2394 |
A flag value of 3 means both grid-fit and anti-alias. |
| 2395 |
|
| 2396 |
On other values are currently documented. |
| 2397 |
|
| 2398 |
.. function:: SetGlyphColor(color) |
| 2399 |
|
| 2400 |
Sets any currently selected glyphs to have the given color (expressed as 24 |
| 2401 |
bit rgb (0xff0000 is red) with the special value of -2 meaning the default |
| 2402 |
color. |
| 2403 |
|
| 2404 |
.. function:: SetGlyphComment(comment) |
| 2405 |
|
| 2406 |
Sets the currently selected glyph to have the given comment. The comment is |
| 2407 |
converted via the current encoding to unicode. |
| 2408 |
|
| 2409 |
.. function:: SetGlyphCounterMask(cg,hint-index,hint-index,...) |
| 2410 |
|
| 2411 |
Creates or sets the counter mask at index cg to contain the hints listed. |
| 2412 |
Hint index 0 corresponds to the first hstem hint, index 1 to the second hstem |
| 2413 |
hint, etc. vstem hints follow hstems. |
| 2414 |
|
| 2415 |
.. function:: SetGlyphName(name[,set-from-name-flag]) |
| 2416 |
|
| 2417 |
Sets the currently selected glyph to have the given name. If |
| 2418 |
set-from-name-flag is absent or is present and true then it will also set the |
| 2419 |
unicode value and the ligature string to match the name. |
| 2420 |
|
| 2421 |
.. function:: SetFondName(fondname) |
| 2422 |
|
| 2423 |
Sets the FOND name of the font. |
| 2424 |
|
| 2425 |
.. function:: SetFontHasVerticalMetrics(flag) |
| 2426 |
|
| 2427 |
Sets whether the font has vertical metrics or not. A 0 value means it does |
| 2428 |
not, any other value means it does. Returns the old setting. |
| 2429 |
|
| 2430 |
.. function:: SetFontNames(fontname[,family[,fullname[,weight[,copyright-notice[,fontversion]]]]]) |
| 2431 |
|
| 2432 |
Sets various postscript names associated with a font. If a name is omitted |
| 2433 |
(or is the empty string) it will not be changed. |
| 2434 |
|
| 2435 |
.. function:: SetFontOrder(order) |
| 2436 |
|
| 2437 |
Sets the font's order. Order must be either 2 (quadratic) or 3 (cubic). It |
| 2438 |
returns the old order. |
| 2439 |
|
| 2440 |
.. function:: SetGlyphChanged(flag) |
| 2441 |
|
| 2442 |
If flag is 1 sets all selected glyphs to be changed, if flag is 0 sets them |
| 2443 |
unchanged. |
| 2444 |
|
| 2445 |
.. function:: SetGlyphClass(class-name) |
| 2446 |
|
| 2447 |
Sets the class on all selected glyphs to be one of "automatic", "none", |
| 2448 |
"base", "ligature", "mark" or "component". |
| 2449 |
|
| 2450 |
.. function:: SetGlyphTeX(height,depth[,subpos,suppos]) |
| 2451 |
|
| 2452 |
Sets the tex_height and tex_depth fields of this glyph. And the subscript pos |
| 2453 |
and superscript pos for math fonts. |
| 2454 |
|
| 2455 |
.. function:: SetItalicAngle(angle[,denom]) |
| 2456 |
|
| 2457 |
Sets the postscript italic angle field appropriately. If denom is specified |
| 2458 |
then angle will be divided by denom before setting the italic angle field (a |
| 2459 |
hack to get real values). The angle should be in degrees. |
| 2460 |
|
| 2461 |
.. function:: SetKern(ch2,offset[,lookup-subtable-name]) |
| 2462 |
|
| 2463 |
Sets the kern between any selected glyphs and the glyph ch2 to be offset. The |
| 2464 |
first argument may be specified as in Select(), the second is an integer |
| 2465 |
representing the kern offset. You can also specify a lookup-subtable-name in |
| 2466 |
which to put the kerning pair. |
| 2467 |
|
| 2468 |
.. function:: SetLBearing(lbearing[,relative]) |
| 2469 |
|
| 2470 |
If the second argument is absent or zero then the left bearing will be set to |
| 2471 |
the first argument, if the second argument is 1 then the left bearing will be |
| 2472 |
incremented by the first, and if the argument is 2 then the left bearing will |
| 2473 |
be scaled by <first argument>/100.0 . In bitmap only fonts see the comment at |
| 2474 |
:func:`SelectBitmap()` about units. Setting this value will adjust all layers |
| 2475 |
so that guides in the background etc will be adjusted with the rest of the glyph. |
| 2476 |
|
| 2477 |
.. function:: SetMacStyle(val) |
| 2478 |
SetMacStyle(str) |
| 2479 |
|
| 2480 |
The argument may be either an integer or a string. If an integer it is a set |
| 2481 |
of bits expressing styles as defined on the mac |
| 2482 |
|
| 2483 |
0x01 |
| 2484 |
- Bold |
| 2485 |
0x02 |
| 2486 |
- Italic |
| 2487 |
0x04 |
| 2488 |
- Underline |
| 2489 |
0x08 |
| 2490 |
- Outline |
| 2491 |
0x10 |
| 2492 |
- Shadow |
| 2493 |
0x20 |
| 2494 |
- Condensed |
| 2495 |
0x40 |
| 2496 |
- Extended |
| 2497 |
\-1 |
| 2498 |
- FontForge should guess the styles from the fontname |
| 2499 |
|
| 2500 |
The bits 0x20 and 0x40 (condensed and extended) may not both be set. |
| 2501 |
|
| 2502 |
If the argument is a string then the string should be the concatenation of |
| 2503 |
various style names, as "Bold Italic Condensed" |
| 2504 |
|
| 2505 |
.. function:: SetMaxpValue(field-name,value) |
| 2506 |
|
| 2507 |
The field-name must be a string and one of: |
| 2508 |
``Zones, TwilightPntCnt, StorageCnt, MaxStackDepth, FDEFs,`` or ``IDEFs``. |
| 2509 |
Value must be an integer. |
| 2510 |
|
| 2511 |
.. function:: SetOS2Value(field-name,field-value) |
| 2512 |
|
| 2513 |
This sets one of the fields of the OS/2 table to the given value. The |
| 2514 |
field-name must be one of the strings listed below: :: |
| 2515 |
|
| 2516 |
Weight, Width, FSType, IBMFamily, VendorID, Panose, WinAscent, WinAscentIsOffset |
| 2517 |
|
| 2518 |
These are equivalent to the WinAscent field & []Offset check box in |
| 2519 |
:ref:`Font Info->OS/2->Misc. <fontinfo.TTF-Values>` Where WinAscentOffset |
| 2520 |
controls whether WinAscent is treated as an absolute number or as relative to |
| 2521 |
the expected number. :: |
| 2522 |
|
| 2523 |
WinDescent, WinDescentIsOffset, |
| 2524 |
TypoAscent, TypoAscentIsOffset, |
| 2525 |
TypoDescent, TypoDescentIsOffset, |
| 2526 |
HHeadAscent, HHeadAscentIsOffset, |
| 2527 |
HHeadDescent, HHeadDescentIsOffset, |
| 2528 |
TypoLineGap, HHeadLineGap, VHeadLineGap, |
| 2529 |
SubXSize, SubYSize, SubXOffset, SubYOffset |
| 2530 |
|
| 2531 |
Sets the Subscript x/y sizes/offsets. :: |
| 2532 |
|
| 2533 |
SupXSize, SupYSize, SupXOffset, SupYOffset |
| 2534 |
|
| 2535 |
Sets the Superscript x/y sizes/offsets. :: |
| 2536 |
|
| 2537 |
StrikeOutSize, StrikeOutPos |
| 2538 |
StyleMap |
| 2539 |
|
| 2540 |
This is equivalent to the "Style Map" pull-down list in |
| 2541 |
:ref:`Font Info->OS/2->Misc. <fontinfo.TTF-Values>` Typical values are 0x01 |
| 2542 |
(Italic), 0x20 (Bold), 0x21 (Bold Italic) and 0x40 (Regular). If the second |
| 2543 |
argument is not a positive value less than 0x400, error flag is set. |
| 2544 |
|
| 2545 |
Usually the second argument is an integer but ``VendorID`` takes a 4 |
| 2546 |
character ASCII string, and ``Panose`` takes a 10 element integer array. |
| 2547 |
|
| 2548 |
.. function:: SetPanose(array) |
| 2549 |
SetPanose(index,value) |
| 2550 |
|
| 2551 |
This sets the panose values for the font. Either it takes an array of 10 |
| 2552 |
integers and sets all the values, or it takes two integer arguments and sets :: |
| 2553 |
|
| 2554 |
font.panose[index] = value |
| 2555 |
|
| 2556 |
.. function:: SetPref(str,val[,val2]) |
| 2557 |
|
| 2558 |
Sets the value of the preference item whose name is contained in str. If the |
| 2559 |
preference item has a real type then a second argument may be passed and the |
| 2560 |
value set will be val/val2. It can execute with no current font. |
| 2561 |
|
| 2562 |
.. function:: SetRBearing(rbearing[,relative]) |
| 2563 |
|
| 2564 |
If the second argument is absent or zero then the right bearing will be set |
| 2565 |
to the first argument, if the second argument is 1 then the right bearing |
| 2566 |
will be incremented by the first, and if the argument is 2 then the right |
| 2567 |
bearing will be scaled by <first argument>/100.0 . In bitmap only fonts see |
| 2568 |
the comment at :func:`SelectBitmap()` about units. |
| 2569 |
|
| 2570 |
.. function:: SetTeXParams(type,design-size,slant,space,stretch,shrink,xheight,quad,extraspace[...]) |
| 2571 |
|
| 2572 |
Sets the TeX (text) font parameters for the font. |
| 2573 |
|
| 2574 |
Type may be 1, 2 or 3, depending on whether the font is text, math or math |
| 2575 |
extension. |
| 2576 |
|
| 2577 |
DesignSize is the pointsize the font was designed for. |
| 2578 |
|
| 2579 |
The remaining parameters are described in Knuth's The MetaFont Book, pp. |
| 2580 |
98-100. |
| 2581 |
|
| 2582 |
Slant is expressed as a percentage. All the others are expressed in em-units. |
| 2583 |
|
| 2584 |
If type is 1 then the 9 indicated arguments are required. If type is 2 then |
| 2585 |
24 arguments are required (the remaining 15 are described in the metafont |
| 2586 |
book). If type is 3 then 15 arguments are required. |
| 2587 |
|
| 2588 |
.. function:: SetTTFName(lang,nameid,utf8-string) |
| 2589 |
|
| 2590 |
Sets the indicated truetype name in the MS platform. Lang must be one of the |
| 2591 |
`language/locales <http://partners.adobe.com/public/developer/opentype/index_name.html#lang3>`__ |
| 2592 |
supported by MS, and nameid must be one of the |
| 2593 |
`small integers used to indicate a standard name <http://partners.adobe.com/public/developer/opentype/index_name.html#enc4>`__, |
| 2594 |
while the final argument should be a utf8 encoded string which will become |
| 2595 |
the value of that entry. A null string ("") may be used to clear an entry. |
| 2596 |
|
| 2597 |
Example: To set the SubFamily string in the American English language/locale :: |
| 2598 |
|
| 2599 |
SetTTFName(0x409,2,"Bold Oblique") |
| 2600 |
|
| 2601 |
.. function:: SetUnicodeValue(uni[,set-from-value-flag]) |
| 2602 |
|
| 2603 |
Sets the currently selected glyph to have the given unicode value. If |
| 2604 |
set-from-value-flag is absent or is present and true then it will also set |
| 2605 |
the name and the ligature string to match the value. |
| 2606 |
|
| 2607 |
.. function:: SetUniqueID(value) |
| 2608 |
|
| 2609 |
Sets the postscript uniqueid field as requested. If you give a value of 0 |
| 2610 |
then FontForge will pick a reasonable random number for you. |
| 2611 |
|
| 2612 |
.. function:: SetVKern(ch2,offset[,lookup-subtable-name]) |
| 2613 |
|
| 2614 |
Sets the kern between any selected glyphs and the glyph ch2 to be offset. The |
| 2615 |
first argument may be specified as in Select(), the second is an integer |
| 2616 |
representing the kern offset. You can also specify a lookup-subtable-name in |
| 2617 |
which to put the kerning pair. |
| 2618 |
|
| 2619 |
.. function:: SetVWidth(vertical-width[,relative]) |
| 2620 |
|
| 2621 |
If the second argument is absent or zero then the vertical width will be set |
| 2622 |
to the first argument, if the second argument is 1 then the vertical width |
| 2623 |
will be incremented by the first, and if the argument is 2 then the vertical |
| 2624 |
width will be scaled by <first argument>/100.0 . In bitmap only fonts see the |
| 2625 |
comment at :func:`SelectBitmap()` about units. |
| 2626 |
|
| 2627 |
.. function:: SetWidth(width[,relative]) |
| 2628 |
|
| 2629 |
If the second argument is absent or zero then the width will be set to the |
| 2630 |
first argument, if the second argument is 1 then the width will be |
| 2631 |
incremented by the first, and if the argument is 2 then the width will be |
| 2632 |
scaled by <first argument>/100.0 . In bitmap only fonts see the comment at |
| 2633 |
:func:`SelectBitmap()` about units. |
| 2634 |
|
| 2635 |
.. function:: Shadow(angle,outline-width,shadow-width) |
| 2636 |
|
| 2637 |
Converts the selected glyphs into shadowed versions of themselves. |
| 2638 |
|
| 2639 |
.. function:: Simplify() |
| 2640 |
Simplify(flags,error[,tan_bounds[,bump_size[,error_denom,line_len_max]]]) |
| 2641 |
|
| 2642 |
With no arguments it does the obvious. If flags is -1 it does a |
| 2643 |
:ref:`Cleanup <elementmenu.Cleanup>`, otherwise flags should be a bitwise or |
| 2644 |
of |
| 2645 |
|
| 2646 |
* 1 -- Slopes may change at the end points. |
| 2647 |
* 2 -- Points which are extremum may be removed |
| 2648 |
* 4 -- Corner points may be smoothed into curves |
| 2649 |
* 8 -- Smoothed points should be snapped to a horizontal or vertical tangent if |
| 2650 |
they are close |
| 2651 |
* 16 -- Remove bumps from lines |
| 2652 |
* 32 -- make lines which are close to horizontal/vertical be |
| 2653 |
horizontal/vertical |
| 2654 |
* 64 -- merge lines which are nearly parallel into one |
| 2655 |
* 128 -- change which point is the start point if a contour's start point is |
| 2656 |
not an extremum |
| 2657 |
|
| 2658 |
The error argument is the number of font units by which the modified path is |
| 2659 |
allowed to stray from the true path. |
| 2660 |
|
| 2661 |
The tan_bounds argument specifies the tangent of the angle between the curves |
| 2662 |
at which smoothing will stop (argument is multiplied by .01 before use). |
| 2663 |
|
| 2664 |
And bump_size gives the maximum distance a bump can move from the line and |
| 2665 |
still be smoothed out. |
| 2666 |
|
| 2667 |
If a fifth argument is given then it will be treated as the denominator of |
| 2668 |
the error term (so users can express fraction pixel distances). |
| 2669 |
|
| 2670 |
Generally it is a bad idea to merge a line segment with any other than a |
| 2671 |
colinear line segment. The longer the line segment, the more likely that such |
| 2672 |
a merge will produce unpleasing results. The sixth argument, if present, |
| 2673 |
specifies the maximum length for lines which may be merged (anything longer |
| 2674 |
will not be merged). |
| 2675 |
|
| 2676 |
.. function:: Sin(val) |
| 2677 |
|
| 2678 |
Returns the sine of val. It can execute with no current font. |
| 2679 |
|
| 2680 |
.. function:: SizeOf(arr) |
| 2681 |
|
| 2682 |
Returns the number of elements in an array. It can execute with no current |
| 2683 |
font. |
| 2684 |
|
| 2685 |
.. function:: Skew(angle[,ox,oy]) |
| 2686 |
Skew(angle-num,angle-denom[,ox,oy]) |
| 2687 |
|
| 2688 |
All selected glyphs will be skewed by the given angle. |
| 2689 |
|
| 2690 |
.. function:: SmallCaps([v-scale[,h-scale[,stemw-scale[,stemh-scale]]]]) |
| 2691 |
|
| 2692 |
Create small capitals from the selected glyphs. When the function |
| 2693 |
generates a new glyph from an (uppercase) letter it names it like |
| 2694 |
the lowercase letter and appends ".sc", e.g., "A" becomes "a.sc". |
| 2695 |
Anything not a letter, i.e., digits and symbols, gets the extension |
| 2696 |
".taboldstyle". |
| 2697 |
|
| 2698 |
The following optional arguments are accepted: |
| 2699 |
|
| 2700 |
.. object:: v-scale |
| 2701 |
|
| 2702 |
The height of the small caps will be this fraction of the height of normal |
| 2703 |
caps. |
| 2704 |
|
| 2705 |
.. object:: h-scale |
| 2706 |
|
| 2707 |
The width of the small caps will be this fraction of the width of normal |
| 2708 |
caps. If unspecified or zero, defaults to the value of v-scale. |
| 2709 |
|
| 2710 |
.. object:: stemw-scale |
| 2711 |
|
| 2712 |
Vertical stems will be scaled by this factor |
| 2713 |
|
| 2714 |
.. object:: stemh-scale |
| 2715 |
|
| 2716 |
Horizontal stems will be scaled by this factor. If unspecified or zero, |
| 2717 |
defaults to the value of stemw-scale. |
| 2718 |
|
| 2719 |
.. function:: SpiroVersion() |
| 2720 |
|
| 2721 |
Returns the version of LibSpiro available to FontForge. |
| 2722 |
|
| 2723 |
Versions 0.1 to 0.5 do not have a method to indicate version numbers, but |
| 2724 |
there is a limited method to estimate versions {'0.0'..'0.5'}. |
| 2725 |
|
| 2726 |
* '0.0' if FontForge has no LibSpiro available. |
| 2727 |
* '0.1' if LibSpiro 20071029 is available. |
| 2728 |
* '0.2' if LibSpiro 0.2 to 0.5 is available. |
| 2729 |
* LibSpiro 0.6 and higher reports back it's version available. |
| 2730 |
|
| 2731 |
.. function:: Sqrt(val) |
| 2732 |
|
| 2733 |
Returns the square root. It can execute with no current font. |
| 2734 |
|
| 2735 |
.. function:: Strcasecmp(str1,str2) |
| 2736 |
|
| 2737 |
Compares the two strings ignoring case, returns zero if the two are equal, a |
| 2738 |
negative number if str1<str2 and a positive number if str1>str2. It can |
| 2739 |
execute with no current font. |
| 2740 |
|
| 2741 |
.. note:: |
| 2742 |
|
| 2743 |
There is no Strcmp function because that is done with relational operators |
| 2744 |
when applied to two strings. |
| 2745 |
|
| 2746 |
.. function:: Strcasestr(haystack,needle) |
| 2747 |
|
| 2748 |
Returns the index of the first occurrence of the string needle within the |
| 2749 |
string haystack ignoring case in the search (or -1 if not found). It can |
| 2750 |
execute with no current font. |
| 2751 |
|
| 2752 |
.. function:: Strftime(format[,isgmt[,locale]]) |
| 2753 |
|
| 2754 |
Same as the c strftime routine. By default it formats the current time in |
| 2755 |
gmt, but if that argument is 0 it will use the local timezone. By default it |
| 2756 |
will format the argument according to the current locale, but if a locale is |
| 2757 |
specified it will be used. |
| 2758 |
|
| 2759 |
.. function:: StrJoin(string-array,delimiter) |
| 2760 |
|
| 2761 |
Returns a single string made by concatenating all the strings in the array |
| 2762 |
together with the delimiter string added after each. So: :: |
| 2763 |
|
| 2764 |
StrJoin(["The","quick","brown","box"]," ") |
| 2765 |
|
| 2766 |
yields :: |
| 2767 |
|
| 2768 |
"The quick brown box" |
| 2769 |
|
| 2770 |
.. function:: Strlen(str) |
| 2771 |
|
| 2772 |
Returns the length of the string. It can execute with no current font. |
| 2773 |
|
| 2774 |
.. function:: Strrstr(haystack,needle) |
| 2775 |
|
| 2776 |
Returns the index of the last occurrence of the string needle within the |
| 2777 |
string haystack (or -1 if not found). It can execute with no current font. |
| 2778 |
|
| 2779 |
.. function:: Strskipint(str[,base]) |
| 2780 |
|
| 2781 |
Parses as much of str as possible and returns the offset to the first |
| 2782 |
character that could not be parsed. It can execute with no current font. |
| 2783 |
|
| 2784 |
.. function:: StrSplit(str,delimiter[,max-cnt]) |
| 2785 |
|
| 2786 |
Splits the string at every occurrence of the delimiter and produces an array |
| 2787 |
of sub-strings. :: |
| 2788 |
|
| 2789 |
StrSplit("The quick brown box"," ") |
| 2790 |
|
| 2791 |
yields :: |
| 2792 |
|
| 2793 |
["The", "quick","brown","box"] |
| 2794 |
|
| 2795 |
If max-cnt is specified then it will limit the number of sub-strings in the |
| 2796 |
array :: |
| 2797 |
|
| 2798 |
StrSplit("The quick brown box"," ",2) |
| 2799 |
|
| 2800 |
yields :: |
| 2801 |
|
| 2802 |
["The", "quick brown box"] |
| 2803 |
|
| 2804 |
.. function:: Strstr(haystack,needle) |
| 2805 |
|
| 2806 |
Returns the index of the first occurrence of the string needle within the |
| 2807 |
string haystack (or -1 if not found). It can execute with no current font. |
| 2808 |
|
| 2809 |
.. function:: Strsub(str,start[,end]) |
| 2810 |
|
| 2811 |
Returns a substring of the string argument. The substring begins at position |
| 2812 |
indexed by start and ends before the position indexed by end (if end is |
| 2813 |
omitted the end of the string will be used, the first position is position |
| 2814 |
0). Thus ``Strsub("abcdef",2,3) == "c"`` and |
| 2815 |
``Strsub("abcdef",2) == "cdef"``. It can execute with no current font. |
| 2816 |
|
| 2817 |
.. function:: Strtod(str) |
| 2818 |
|
| 2819 |
Converts a string to a real number. It can execute with no current font. |
| 2820 |
|
| 2821 |
.. function:: Strtol(str[,base]) |
| 2822 |
|
| 2823 |
Parses as much of str as possible and returns the integer value it |
| 2824 |
represents. A second argument may be used to specify the base of the |
| 2825 |
conversion (it defaults to 10). Behavior is as for strtol(3). It can execute |
| 2826 |
with no current font. |
| 2827 |
|
| 2828 |
.. function:: SubstitutionPoints() |
| 2829 |
|
| 2830 |
.. function:: Tan(val) |
| 2831 |
|
| 2832 |
Returns the tangent of val. It can execute with no current font. |
| 2833 |
|
| 2834 |
.. function:: ToLower(val) |
| 2835 |
|
| 2836 |
Returns value converted to a lower case letter. Val may be either an integer, |
| 2837 |
a unicode or a string. The first two cases are treated as unicode code |
| 2838 |
points, in the third the entire string will be converted. It can execute with |
| 2839 |
no current font. |
| 2840 |
|
| 2841 |
.. function:: ToMirror(val) |
| 2842 |
|
| 2843 |
Converts value to a mirror form (used in r2l scripts where the latin open |
| 2844 |
parenthesis looks like a close parenthesis). Val may be either an integer, a |
| 2845 |
unicode or a string. The first two cases are treated as unicode code points, |
| 2846 |
in the third the entire string will be converted. It can execute with no |
| 2847 |
current font. |
| 2848 |
|
| 2849 |
.. function:: ToString(arg) |
| 2850 |
|
| 2851 |
Converts its argument to a string. (the output is what the Print() command |
| 2852 |
would print) It can execute with no current font. |
| 2853 |
|
| 2854 |
.. function:: ToUpper(val) |
| 2855 |
|
| 2856 |
Returns value converted to an upper case letter. Val may be either an |
| 2857 |
integer, a unicode or a string. The first two cases are treated as unicode |
| 2858 |
code points, in the third the entire string will be converted. It can execute |
| 2859 |
with no current font. |
| 2860 |
|
| 2861 |
.. function:: Transform(t1,t2,t3,t4,t5,t6) |
| 2862 |
|
| 2863 |
Each argument will be divided by 100. and then all selected glyphs will be |
| 2864 |
transformed by this matrix |
| 2865 |
|
| 2866 |
.. math:: |
| 2867 |
|
| 2868 |
\begin{bmatrix} |
| 2869 |
\frac{t_1}{100} & \frac{t_3}{100} & \frac{t_5}{100} \\ |
| 2870 |
\frac{t_2}{100} & \frac{t_4}{100} & \frac{t_6}{100} |
| 2871 |
\end{bmatrix} |
| 2872 |
|
| 2873 |
This is a standard PostScript transformation matrix where |
| 2874 |
|
| 2875 |
.. math:: |
| 2876 |
|
| 2877 |
x' &= \frac{t_1}{100}x + \frac{t_3}{100}y + \frac{t_5}{100} \\ |
| 2878 |
y' &= \frac{t_2}{100}x + \frac{t_4}{100}y + \frac{t_6}{100} |
| 2879 |
|
| 2880 |
The peculiar notion of dividing by 100 was to overcome the fact that |
| 2881 |
fontforge's scripting language formerly could not handle real numbers. We've |
| 2882 |
overcome that limitation since, but it seemed best to leave the behavior of |
| 2883 |
the function as it was. |
| 2884 |
|
| 2885 |
.. function:: TypeOf(any) |
| 2886 |
|
| 2887 |
Returns a string naming the type of the argument: |
| 2888 |
|
| 2889 |
* "Integer" |
| 2890 |
* "Real" |
| 2891 |
* "Unicode" |
| 2892 |
* "String" |
| 2893 |
* "Array" |
| 2894 |
* "Void" |
| 2895 |
|
| 2896 |
(The following type is used internally, but I don't think the user can ever |
| 2897 |
see it. It is included here for completeness) |
| 2898 |
* "LValue" |
| 2899 |
|
| 2900 |
It can execute with no current font. |
| 2901 |
|
| 2902 |
.. function:: UCodePoint(int) |
| 2903 |
|
| 2904 |
Converts the argument to a unicode code point (a special type used in several |
| 2905 |
commands). It can execute with no current font. |
| 2906 |
|
| 2907 |
.. function:: UnicodeAnnotationFromLib(val) |
| 2908 |
|
| 2909 |
Returns the Unicode Annotations for this value as described by |
| 2910 |
www.unicode.org. If there is no unicode annotation for this value, or no |
| 2911 |
library available, then return empty string "". It can execute with no |
| 2912 |
current font. |
| 2913 |
|
| 2914 |
.. function:: UnicodeBlockCountFromLib() |
| 2915 |
|
| 2916 |
Return the number of Unicode Blocks for this list as described by |
| 2917 |
www.unicode.org. Currently, the blocks are {0..233}, spanning unicode values |
| 2918 |
{uni0..uni10FFFF}. This can execute with no current font. |
| 2919 |
|
| 2920 |
.. function:: UnicodeBlockEndFromLib(val) |
| 2921 |
|
| 2922 |
Returns the Unicode Block end value as described by www.unicode.org. |
| 2923 |
Currently, the blocks are {0..233}, spanning unicode values |
| 2924 |
{uni0..uni10FFFF}. This can execute with no current font. |
| 2925 |
|
| 2926 |
.. function:: UnicodeBlockNameFromLib(val) |
| 2927 |
|
| 2928 |
Returns the Unicode Block Name as described by www.unicode.org. Currently, |
| 2929 |
the blocks are {0..233}, spanning unicode values {uni0..uni10FFFF}. If there |
| 2930 |
is no value, or no library available, then return empty string "". This can |
| 2931 |
execute with no current font. |
| 2932 |
|
| 2933 |
.. function:: UnicodeBlockStartFromLib(val) |
| 2934 |
|
| 2935 |
Returns the Unicode Block start value as described by www.unicode.org. |
| 2936 |
Currently, the blocks are {0..233}, spanning unicode values |
| 2937 |
{uni0..uni10FFFF}. If there is no value, then return -1. This can execute |
| 2938 |
with no current font. |
| 2939 |
|
| 2940 |
.. function:: UnicodeFromName(name) |
| 2941 |
|
| 2942 |
Looks the string "name" up in FontForge's database of commonly used glyph |
| 2943 |
names and returns the unicode value associated with that name, or -1 if not |
| 2944 |
found. This does *not* check the current font (if any). It can execute with |
| 2945 |
no current font. |
| 2946 |
|
| 2947 |
.. function:: UnicodeNameFromLib(val) |
| 2948 |
|
| 2949 |
Returns the Unicode Name for this value as described by www.unicode.org. If |
| 2950 |
there is no unicode name for this value, then return empty string "". It can |
| 2951 |
execute with no current font. |
| 2952 |
|
| 2953 |
.. function:: UnicodeNamesListVersion() |
| 2954 |
|
| 2955 |
Return the Unicode Nameslist Version (as described by www.unicode.org). |
| 2956 |
|
| 2957 |
This can execute with no current font. |
| 2958 |
|
| 2959 |
.. function:: UnicodeNames2FromLib(val) |
| 2960 |
|
| 2961 |
Errors and corrections happen, therefore names can be corrected in the next |
| 2962 |
Unicode Nameslist version. This function returns the formal alias for the |
| 2963 |
unicode value given, or an empty string if there is no such alias. |
| 2964 |
|
| 2965 |
.. function:: UnlinkReference |
| 2966 |
|
| 2967 |
Unlinks all references within all selected glyphs |
| 2968 |
|
| 2969 |
.. function:: Ucs4(str) |
| 2970 |
|
| 2971 |
Takes a string in Utf8 encoding and returns an array of integers, one for |
| 2972 |
each unicode character in the string. |
| 2973 |
|
| 2974 |
.. function:: Utf8(int) |
| 2975 |
|
| 2976 |
Takes an integer [0,0x10ffff] and returns the utf8 string representing that |
| 2977 |
unicode code point. If passed an array of integers it will generate a utf8 |
| 2978 |
string containing all of those unicode code points. (it does not expect to |
| 2979 |
get surrogates). It can execute with no current font. |
| 2980 |
|
| 2981 |
.. function:: Validate([force]) |
| 2982 |
|
| 2983 |
Validates the font and returns a bitmask of errors. If the font passes it |
| 2984 |
will return 0. Normally each glyph will cache its validation_state and it |
| 2985 |
will not be recalculated. If you pass a non-zero argument to the routine then |
| 2986 |
it will force recalculation of each glyph -- this can be slow. |
| 2987 |
|
| 2988 |
.. function:: VFlip([about-y]) |
| 2989 |
|
| 2990 |
All selected glyphs will be vertically flipped about the horizontal line |
| 2991 |
through y=about-y. If no argument is given then all selected glyphs will be |
| 2992 |
flipped about their central point. |
| 2993 |
|
| 2994 |
.. function:: VKernFromHKern() |
| 2995 |
|
| 2996 |
Removes all vertical kern pairs and classes from the current font, and then |
| 2997 |
generates new vertical kerning pairs by copying the horizontal kerning data |
| 2998 |
for a pair of glyphs to the vertically rotated versions of those glyphs. |
| 2999 |
|
| 3000 |
.. function:: Wireframe(angle,outline-width,shadow-width) |
| 3001 |
|
| 3002 |
Converts the selected glyphs into wireframed versions of themselves. |
| 3003 |
|
| 3004 |
.. function:: WorthOutputting([arg]) |
| 3005 |
|
| 3006 |
If there is no argument then a single glyph should be selected and the |
| 3007 |
function applies to that glyph, otherwise arg is as in :func:`InFont()`. |
| 3008 |
This returns true if the glyph contains any splines, references, images or |
| 3009 |
has had its width set. |
| 3010 |
|
| 3011 |
.. function:: WriteStringToFile("string","Filename"[,append]) |
| 3012 |
|
| 3013 |
Creates the file named "Filename" and writes the string to it. If the append |
| 3014 |
flag is present and non-zero, then the string will be appended to the file. |
| 3015 |
This deals with null-terminated strings, not with byte arrays. Returns -1 on |
| 3016 |
failure otherwise the number of bytes written. It can execute with no current |
| 3017 |
font. |