/usr/share/doc/defoma-doc/defoma-script.html/ch7.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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>A Tutorial on Writing Defoma Configuration Script - Using x-postscript Category.</title>
<link href="index.html" rel="start">
<link href="ch6.html" rel="prev">
<link href="index.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 Introduction">
<link href="ch2.html" rel="chapter" title="2 Simple Defoma-configuration script.">
<link href="ch3.html" rel="chapter" title="3 Using hints.">
<link href="ch4.html" rel="chapter" title="4 Using Defoma::Id module.">
<link href="ch5.html" rel="chapter" title="5 Using Defoma::Id (2)">
<link href="ch6.html" rel="chapter" title="6 Using Defoma::Subst module.">
<link href="ch7.html" rel="chapter" title="7 Using x-postscript Category.">
</head>
<body>
<p><a name="ch7"></a></p>
<hr>
<p>
[ <a href="ch6.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch1.html">1</a> ]
[ <a href="ch2.html">2</a> ]
[ <a href="ch3.html">3</a> ]
[ <a href="ch4.html">4</a> ]
[ <a href="ch5.html">5</a> ]
[ <a href="ch6.html">6</a> ]
[ 7 ]
[ <a href="index.html">next</a> ]
</p>
<hr>
<h1>
A Tutorial on Writing Defoma Configuration Script
<br>Chapter 7 - Using x-postscript Category.
</h1>
<hr>
<p>
Many X applications that output a PostScript file and substitute X fonts for
PostScript fonts for displaying want a list of PostScript fonts and substitute
X fonts. x-postscript category will satisfy this demand. A font in this
category is a name of PostScript font with `<X>/' prefix added, like
<samp><X>/Times-Roman</samp>, and each font has a XLFD as a hint. The
XLFD is considered to have the most similar appearance to the PostScript font.
If the script wants to make use of x-postscript category, its package must
`Depends:' on psfontmgr.
</p>
<p>
The strategy of the Defoma-configuration script which accepts only x-postscript
category is to ignore all commands except term, and generate a configuration
file in term commands. To obtain available PostScript fonts and their
substitutive XLFDs, the script calls <samp>defoma_font_get_fonts()</samp>
function, which returns a list of fonts registered in the specified category,
and <samp>defoma_font_get_hints()</samp> function, which returns hints of the
specified font. All and only available (installed) x-postscript category fonts
are obtained through these functions.
</p>
<p>
Following is an example of the header of the script. Note that there's
declaration of using Defoma::Font module for
<samp>defoma_font_get_fonts()</samp> and <samp>defoma_font_get_hints()</samp>
functions.
</p>
<pre>
@ACCEPT_CATEGORIES = ('x-postscript');
package example;
use Debian::Defoma::Font;
import Debian::Defoma::Font;
</pre>
<p>
The main routine goes like this:
</p>
<pre>
sub x_postscript {
my $com = shift;
return 0 if ($com ne 'term');
open(F, '>/var/lib/defoma/example.d/font.conf');
my @fonts = defoma_font_get_fonts('x-postscript');
foreach my $psfont (@fonts) {
my @hints = defoma_font_get_hints('x-postscript', $psfont);
$psfont =~ s/^\<X\<\///;
my $xfont = $hints[0];
print F "$psfont $xfont\n";
}
close F;
}
</pre>
<p>
This simple codes will generate a list of PostScript fonts and XLFDs like
following.
</p>
<pre>
Helvetica -adobe-helvetica-medium-r-normal--0-0-0-0-p-0-iso8859-1
Helvetica-Bold -adobe-helvetica-bold-r-normal--0-0-0-0-p-0-iso8859-1
Ryumin-Light-H -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1983-0
</pre>
<hr>
<p>
[ <a href="ch6.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch1.html">1</a> ]
[ <a href="ch2.html">2</a> ]
[ <a href="ch3.html">3</a> ]
[ <a href="ch4.html">4</a> ]
[ <a href="ch5.html">5</a> ]
[ <a href="ch6.html">6</a> ]
[ 7 ]
[ <a href="index.html">next</a> ]
</p>
<hr>
<p>
A Tutorial on Writing Defoma Configuration Script
</p>
<address>
Yasuhiro Take<br>
<br>
</address>
<hr>
</body>
</html>
|