/usr/share/doc/defoma-doc/developers.html/ch1.html is in defoma-doc 0.11.12ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Developers' Guide to Defoma - Font Package's TODO</title>
<link href="index.html" rel="start">
<link href="index.html" rel="prev">
<link href="ch2.html" rel="next">
<link href="index.html#contents" rel="contents">
<link href="index.html#copyright" rel="copyright">
<link href="ch1.html" rel="chapter" title="1 Font Package's TODO">
<link href="ch2.html" rel="chapter" title="2 Application Package's HOWTO">
<link href="ch1.html#s1.1" rel="section" title="1.1 Creating Hintfile.">
<link href="ch1.html#s1.2" rel="section" title="1.2 Editing Hintfile.">
<link href="ch1.html#s1.3" rel="section" title="1.3 Packaging.">
<link href="ch1.html#s1.2.1" rel="subsection" title="1.2.1 Multiple Face/Charset in a Single Font.">
<link href="ch1.html#s1.3.1" rel="subsection" title="1.3.1 Using dh_installdefoma.">
<link href="ch1.html#s1.3.2" rel="subsection" title="1.3.2 Without using dh_installdefoma.">
</head>
<body>
<p><a name="ch1"></a></p>
<hr>
<p>
[ <a href="index.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ 1 ]
[ <a href="ch2.html">2</a> ]
[ <a href="ch2.html">next</a> ]
</p>
<hr>
<h1>
Developers' Guide to Defoma
<br>Chapter 1 - Font Package's TODO
</h1>
<hr>
<p>
Font packages should register their fonts to Defoma if the font may be used by
various applications. Registration and Unregistration should be performed at
postinst and postrm respectively of a font package, so maintainers need to edit
them. In addition, each font may have various information called hints which
represents its appearance and other data used to achieve appropriate
configuration for a specific application, so maintainers need to generate
hints.
</p>
<hr>
<h2><a name="s1.1"></a>1.1 Creating Hintfile.</h2>
<p>
<em>Hintfile</em> describes several fonts and their hints in a single file.
Generally, registration and unregistration of fonts are performed through
Hintfile, so creating one is the first step to Defoma-ize a font package.
</p>
<p>
First of all, enter a package's top directory. If the fonts of the package are
located under subdirectory, please enter there, and run the following command.
</p>
<pre>
defoma-hints <category> <font>... 2> hintfile
</pre>
<p>
This command asks various questions for each font listed in <font> which
must belong to the specified <category>, and will output Hintfile to
hintfile. The hintfile will contain definitions for all the fonts.
</p>
<p>
If categories of the fonts are partly different, you must run the command and
create a hintfile for each category. In other words, category of the fonts
described in a single hintfile must be unified.
</p>
<p>
Note that this command sometimes fails unfortunately because hints-generating
routines are not provided for some categories. Currently supported categories
are cid, cmap, truetype and type1.
</p>
<p>
For example, if your font package is placed under <samp>~/font-foo-0.1/</samp>,
and the <samp>type1</samp> fonts <samp>foo1.pfa</samp>, <samp>foo2.pfa</samp>
and <samp>foo3.pfa</samp> are located at <samp>fonts/</samp> subdirectory,
please enter there and run the command like following.
</p>
<pre>
cd ~/font-foo-0.1/fonts
defoma-hints type1 foo1.pfa foo2.pfa foo3.pfa > hintfile
</pre>
<hr>
<h2><a name="s1.2"></a>1.2 Editing Hintfile.</h2>
<p>
After creating Hintfile, you may possibly want to edit one because mechanically
created hints are sometimes not enough. This section describes how to modify a
hintfile and its syntax.
</p>
<p>
Hintfile may contain three elements: category declaration, font definitions and
comments. Font definitions and comments are permitted to appear in a single
hintfile any number of times, while category declaration must not exist more
than once.
</p>
<p>
Category declaration is generally put at the beginning of a hintfile because it
must be put before font definitions. Its syntax is:
</p>
<pre>
category <category-name>
</pre>
<p>
Font definition describes one font and its hints. It starts with the
<samp>begin</samp> line and ends with the <samp>end</samp> line. The
<samp>begin</samp> line also specifies which font is to be defined. Lines
between these two lines describes hints of the font. Hintfile must not contain
more than one font definition of a single font. The syntax of font definition
is:
</p>
<pre>
begin <font>
<HintTypeA> = <hintA1>
<HintTypeB> = <hintB1> <hintB2>
...
end
</pre>
<p>
Lines starting with `#' are considered as comments.
</p>
<p>
Following is the generated hintfile of the mentioned example.
</p>
<pre>
category type1
begin /path/to/foo1.pfa
FontName = Foo-Regular
Family = Foo
Weight = Medium
Shape = Upright NoSerif
GeneralFamily = SansSerif
Charset = ISO8859-1
Alias = Foo
Priority = 30
X-FontName = -adobe-foo-medium-r-normal--0-0-0-0-p-0-iso8859-1
end
begin /path/to/foo2.pfa
FontName = Foo-Bold
Family = Foo
Weight = Bold
Shape = Upright NoSerif
GeneralFamily = SansSerif
Charset = ISO8859-1
Alias = FooBold
Priority = 30
X-FontName = -adobe-foo-bold-r-normal--0-0-0-0-p-0-iso8859-1
end
begin /path/to/foo3.pfa
FontName = Foo-Italic
Family = Foo
Weight = Medium
Shape = Italic NoSerif
GeneralFamily = SansSerif
Charset = ISO8859-1
Alias = FooItalic
Priority = 30
X-FontName = -adobe-foo-medium-i-normal--0-0-0-0-p-0-iso8859-1
end
</pre>
<p>
The first thing you have to do is to change filenames of fonts to the full
paths where these fonts are actually installed. Let's asuume that the
font-foo.deb installs these fonts into <samp>/usr/share/fonts/type1</samp>,
then the hintfile goes like this:
</p>
<pre>
category type1
begin /usr/share/fonts/type1/foo1.pfa
..
begin /usr/share/fonts/type1/foo2.pfa
..
begin /usr/share/fonts/type1/foo3.pfa
</pre>
<p>
After this necessary work done, you may want to change or add some hints. The
Syntax of describing hints is:
</p>
<pre>
<HintType> = <hint>...
</pre>
<p>
where <HintType> decides what type of information is described, and
<hint> is a value of the <HintType>. You can specify more than one
<hint> for one <HintType> by separating them with space.
</p>
<p>
Hints include information about the appearance. This information should be
correctly set to have better results of substituion by Defoma font substitution
mechanism. HintTypes for appearance and their description are listed below.
</p>
<ul>
<li>
<p>
Weight .. represents the weight of a font. Bold and Light are the most values
for this HintType.
</p>
</li>
</ul>
<ul>
<li>
<p>
Width .. is either Variable or Fixed, which represents whether the width of a
font varies or not.
</p>
</li>
</ul>
<ul>
<li>
<p>
GeneralFamily .. is a rough grouping of the appearance of a font. The values
of this HintType for alphabetical fonts are Roman, SansSerif, Typewriter and
Script. The values for CJK hieroglyphs are Mincho, Gothic and Maru. Symbol is
the value for symbolic fonts. You can set your preferred value to this
HintType if none of the above matches to your font.
</p>
</li>
</ul>
<ul>
<li>
<p>
Shape .. includes other appearance information like Serif/NoSerif,
Upright/Italic/Oblique, and Condensed/Expanded.
</p>
</li>
</ul>
<p>
In addition, essential information is also included in hints. As the word
`essential' tells, this information is required for most categories. The
values for some of the essential HintTypes are predefined. Following is a list
of essential information.
</p>
<ul>
<li>
<p>
FontName .. is a real name of the font. You should not specify more than one
values to this HintType. The value should be PostScript-like font name.
</p>
<p>
Charset .. represents standards of collections of characters which the font
contains. The values for this HintType is predefined and is listed below.
</p>
<ul>
<li>
<p>
ISO8859-<em>n</em> (n = 1..15)
</p>
</li>
</ul>
<ul>
<li>
<p>
KOI8-R (Russian standard)
</p>
</li>
</ul>
<ul>
<li>
<p>
KOI8-U (Ukrainian standard)
</p>
</li>
</ul>
<ul>
<li>
<p>
JISX0208, JISX0212, JISX0201 (Japanese standards)
</p>
</li>
</ul>
<ul>
<li>
<p>
KSX1001, KSX1003 (Korean standards)
</p>
</li>
</ul>
<ul>
<li>
<p>
GB2312, GBK, GB18030 (Chinese (PRC) standards)
</p>
</li>
</ul>
<ul>
<li>
<p>
CNS11643-<em>n</em> (Taiwan national standard)
</p>
</li>
</ul>
<ul>
<li>
<p>
BIG5 (Taiwan de-facto standard)
</p>
</li>
</ul>
<ul>
<li>
<p>
BIG5-HKSCS (HongKong standard)
</p>
</li>
</ul>
<ul>
<li>
<p>
font-specific (for symbolic fonts)
</p>
</li>
</ul>
<ul>
<li>
<p>
ISO10646-1
</p>
</li>
</ul>
</li>
</ul>
<ul>
<li>
<p>
UniCharset .. represents actual Charset contained by a font whose Charset is
ISO10646-1. ISO10646-1 can be considered as a collection of already existing
Charsets, so when Charset of a font is ISO10646-1, UniCharset should represent
its actual content.
</p>
</li>
</ul>
<ul>
<li>
<p>
Encoding .. represents which encoding is used to access the font. Most
categories do not limit the encoding, so this HintType is omitted in most
cases.
</p>
</li>
</ul>
<ul>
<li>
<p>
Direction .. represents the direction of writing for which the glyphs of the
font are for. The value is either Vertical or Horizontal.
</p>
</li>
</ul>
<ul>
<li>
<p>
Location .. is only used in truetype category. defoma-hints will
automatically set this value, so you do not need to consider about this
HintType.
</p>
</li>
</ul>
<p>
Finally, additional information is also included in hints.
</p>
<ul>
<li>
<p>
Alias .. represents other name(s) of the font. As the same as FontName, the
value for this HintType should be PostScript-like.
</p>
</li>
</ul>
<ul>
<li>
<p>
Priority .. represents the degree of preference of the font. This value
should be specified in an integer between 0 and 99. Generally, beautiful
scalable fonts should have higher priority.
</p>
</li>
</ul>
<ul>
<li>
<p>
X-FontName .. is XLFD(s) of the font, if the font is used in X. Defoma
doesn't take part in font configuration in X, so packages must install the font
to X separately. Usually the value can be taken from .scale file.
</p>
<p>
NOTE: x-ttcidfont-conf manages configuration of TrueType and CID fonts for X
through the Defoma framework, so font packages for these fonts do not or should
not install the font to X separately. Instead, just register fonts to Defoma.
</p>
</li>
</ul>
<ul>
<li>
<p>
Transform .. controls if the font is transformed into Bold shape and/or
Slanted shape. Its values are: Boldize, Slant, NotBoldize and NotSlant.
</p>
</li>
</ul>
<hr>
<h3><a name="s1.2.1"></a>1.2.1 Multiple Face/Charset in a Single Font.</h3>
<p>
Some Type1 fonts contain multiple charsets in a single pfa/pfb file, and
TrueType Collection fonts (.ttc) contain multiple faces in a single ttc file.
It means individual hints are needed for each face/charset. To realize this,
defoma provides subhints mechanism.
</p>
<p>
This is an example of a hintfile for a type1 font with multiple encoding. The
font a.pfa (Helvetica) is usually accessed in ISO8859-1 encoding, but by
re-encoding the font, it can also be accessed in ISO8859-2 and KOI8-R
encodings.
</p>
<pre>
category type1
begin /font/a.pfa
FaceNum = 3
Inherit = Weight Shape Width Priorty Family GeneralFamily
FontName = Helvetica
Charset = ISO8859-1
Weight = Medium
Shape = Upright NoSerif
Family = Helvetica
GeneralFamily = SansSerif
Priority = 20
X-FontName = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso8859-1
FontName1 = Helvetica-ISO8859-2
Charset1 = ISO8859-2
X-FontName1 = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso8859-2
FontName2 = Helvetica-KOI8-R
Charset2 = KOI8-R
X-FontName2 = -foo-bar-medium-r-normal--0-0-0-0-p-0-koi8-r
end
</pre>
<p>
You will find out unfamiliar hinttype FaceNum and Inherit, and numbered
hinttypes.
</p>
<p>
Non-numbered hints contain hints for the default charset ISO8859-1 in the same
way as usual Type1 fonts. Hints can be inherited to subhints, and Inherit
hinttype decides which hinttypes to be inherited, so hints that are common to
most of the subhints like Family, Weight and Shape, you should set the hinttype
Inherit.
</p>
<p>
FaceNum hinttype specifies how many subhints the hints contain. In this
example, there are two subhints plus default hints, so its value is set to 3.
</p>
<p>
Numbered hints are called subhints, which consist of charset specific hints.
In this example, subhints only contains FontName, Charset and X-FontName.
Other important hinttypes are inherited from Non-numbered hints.
</p>
<p>
Here's another example for a Unicode Type1 font, which is usually accessed in
Unicode encoding, and by re-encoding the font, it can also be accessed in
ISO8859-1, ISO8859-2 and ISO8859-3.
</p>
<pre>
category type1
begin /font/b.pfa
FaceNum = 4
Inherit = Weight Shape Width Proirty Family GeneralFamily
FontName = Helvetica-Unicode
Charset = ISO10646-1
UniCharset = ISO8859-1 ISO8859-2 ISO8859-3
Weight = Medium
Shape = Upright NoSerif
Family = Helvetica
GeneralFamily = SansSerif
Priority = 20
X-FontName = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso10646-1
FontName1 = Helvetica-ISO8859-1
Charset1 = ISO8859-1
X-FontName1 = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso8859-1
FontName2 = Helvetica-ISO8859-2
Charset2 = ISO8859-2
X-FontName1 = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso8859-2
FontName1 = Helvetica-ISO8859-3
Charset1 = ISO8859-3
X-FontName1 = -foo-bar-medium-r-normal--0-0-0-0-p-0-iso8859-3
end
</pre>
<p>
Note that the value of non-numbered Charset is ISO10646-1 and UniCharset
represents what charsets the Unicode Type1 font actually consists of.
</p>
<p>
This is an example for Unicode TrueType fonts whose glyphs are correspondent to
a collection of ISO8859-1, ISO8859-2 and ISO8859-3.
</p>
<pre>
category truetype
begin /font/c.ttf
FontName = Verdy-Bold
Charset = ISO8859-1 ISO8859-2 ISO8859-3 ISO10646-1
UniCharset = ISO8859-1 ISO8859-2 ISO8859-3
Encoding = Unicode
Location = English Slovenian Turkish
Weight = Bold
Shape = NoSerif
GeneralFamily = SansSerif
Family = Verdy
end
</pre>
<p>
No subhint is needed to represent multiple charsets of TrueType fonts. Setting
Charset to the available charsets will do.
</p>
<hr>
<h2><a name="s1.3"></a>1.3 Packaging.</h2>
<p>
Now let's build a Defoma-aware font package. To make things easier, using
debhelper is strongly recommended. Following tutorial describes about a
debhelper-based package.
</p>
<hr>
<h3><a name="s1.3.1"></a>1.3.1 Using dh_installdefoma.</h3>
<p>
Since defoma 0.7.0, it provides a debhelper program for defoma named
dh_installdefoma. Using this program makes it much easier to defoma-ize a
package.
</p>
<ol type="1" start="1" >
<li>
<p>
Put the hintfile into <samp>debian/</samp> subdirectory and name it as
defoma-hints.
</p>
<pre>
mv fonts/hintfile debian/defoma-hints
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Edit <samp>debian/rules</samp> to calldh_installdefoma in binary-indep or
binary-arch phase. it may be best to add it just after dh_installdebconf.
</p>
<pre>
(ex: debian/rules)
binary-indep: build install
dh_testdir
dh_testroot
dh_installdebconf
dh_installdefoma
dh_installdocs
...
</pre>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Edit <samp>debian/control</samp> to make the package depend and build-depend on
defoma.
</p>
<pre>
(ex: debian/control)
Build-Depends: defoma (>= 0.7.0)
...
Depends: defoma
...
</pre>
</li>
</ol>
<hr>
<h3><a name="s1.3.2"></a>1.3.2 Without using dh_installdefoma.</h3>
<p>
Although using dh_installdefoma is strongly recommended, sometimes you have to
do what dh_installdefoma does manually. Following lists describes this ordinal
way of defoma-izing.
</p>
<ol type="1" start="1" >
<li>
<p>
Put hintfile(s) into <samp>debian/</samp> subdirectory.
</p>
<pre>
mv fonts/hintfile debian/
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Edit the <samp>debian/rules</samp> file to install the hintfile(s) into
<samp>etc/defoma/hints/</samp> directory as
<samp><package-name>.hints</samp>.
</p>
<pre>
(ex: debian/rules)
PKG = <package-name>
DIR = `pwd`/debian/$(PKG)
install: build
...
install -m 644 debian/hintfile \
$(DIR)/etc/defoma/hints/$(PKG).hints
</pre>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
To create the <samp>etc/defoma/hints</samp> directory before actually
installing the hintfile there, edit <samp>debian/dirs</samp>.
</p>
<pre>
(ex: debian/dirs)
etc/defoma/hints
</pre>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
The hintfile must be a conffile, so edit <samp>debian/conffiles</samp>.
</p>
<pre>
(ex: debian/conffiles)
/etc/defoma/hints/<package-name>.hints
</pre>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
Registration of fonts must be performed at postinst. Edit
<samp>debian/postinst</samp> to call defoma-font with reregister-all command.
NOTE that the command is not register-all. Using this command is able to not
only just register fonts described in a hintfile, but also update revised hints
to Defoma, so this command is used for both newly installing and upgrading
purpose.
</p>
<pre>
(ex: debian/postinst)
...
FILE='/etc/defoma/hints/<package-name>.hints'
if [ "$1" = configure ]; then
/usr/bin/defoma-font reregister-all $FILE
fi
</pre>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
Unregistration of fonts must be performed at prerm when the package is going to
be removed. Edit <samp>debian/prerm</samp> to call defoma-font with purge-all
command.
</p>
<pre>
(ex: debian/prerm)
...
FILE='/etc/defoma/hints/<package-name>.hints'
if [ "$1" = remove ]; then
/usr/bin/defoma-font purge-all $FILE
fi
</pre>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
Edit <samp>debian/control</samp> to make the package depend on defoma.
</p>
<pre>
(ex: debian/control)
...
Depends: defoma
...
</pre>
</li>
</ol>
<hr>
<p>
[ <a href="index.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ 1 ]
[ <a href="ch2.html">2</a> ]
[ <a href="ch2.html">next</a> ]
</p>
<hr>
<p>
Developers' Guide to Defoma
</p>
<address>
Yasuhiro Take (take@debian.org)<br>
<br>
</address>
<hr>
</body>
</html>
|