/usr/share/doc/swi-prolog-doc/UserGuide/font.html is in swi-prolog-doc 5.6.59-1.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Programming in XPCE/Prolog: Section 10.9</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="errors.html">
<LINK REL=next HREF="images.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef
{ background-color: #c5e1ff;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
/* Footnotes */
sup.fn { color: blue; text-decoration: underline; }
span.fn-text: { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="errors.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="images.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>
<H2><A NAME="sec:10.9"><SPAN class="sec-nr">10.9</SPAN> <SPAN class="sec-title">Specifying
fonts</SPAN></A></H2>
<A NAME="sec:font"></A>
<P><font size=-1>XPCE</font>'s font specification is a two-stage
process. In the first stage,
<font size=-1>XPCE</font> physical fonts are mapped to fonts of the
underlying windowing system. In this stage, fonts are identified by
their <EM>family</EM>,
<EM>style</EM> and <EM>size</EM>. For example
<PRE class="code">
font(screen, roman, 13)
</PRE>
<P>Refers to a fixed-width font designed for use on the screen that has
normal weight, not slanted and 13-pixels high characters.
<P>In the second stage, logical font-names are mapped to their physical
implementation. At this level, fonts are identified by a single name
from an extensible, but preferably small set.
<P>See <A class="sec" href="winfont.html">section B.5</A> for a
description of Windows specific font issues.
<H3><A NAME="sec:10.9.1"><SPAN class="sec-nr">10.9.1</SPAN> <SPAN class="sec-title">Physical
fonts</SPAN></A></H3>
<P>The default physical font set is built when the first font object is
opened (i.e. its window counterpart is located and made available to the
text-drawing functions). This set is created from class-variables on the
display object. The first class-variable is display.font_families, which
defines a chain with names of the font-families. The default value is:<SUP class="fn">11<SPAN class="fn-text">See <A class="sec" href="classvar.html">section
8</A> for the default syntax.</SPAN></SUP>
<PRE class="code">
display.font_families: \
[ screen_fonts, \
courier_fonts, \
helvetica_fonts, \
times_fonts, \
symbol_fonts
]
</PRE>
<P>Each of these names refers to the name of another resource of class
<A class="" href="summary.html#class:display">display</A>, enumerating
the members of this font family. The default value can be examined using
the online manual. Below is the default value for the <CODE>screen_fonts</CODE>
font-set for X11:
<PRE class="code">
display.screen_fonts: \
[ font(screen, roman, 10, "6x10"), \
font(screen, roman, 12, "6x12"), \
font(screen, roman, 13, "8x13"), \
font(screen, roman, 14, "7x14"), \
font(screen, roman, 15, "9x15"), \
font(screen, bold, 13, "8x13bold"), \
font(screen, bold, 14, "7x14bold"), \
font(screen, bold, 15, "9x15bold") \
]
</PRE>
<P>The set of predefined physical fonts can be examined using the
FontViewer demo application accessible through the online manual tools.
<H4><A NAME="sec:10.9.1.1"><SPAN class="sec-nr">10.9.1.1</SPAN> <SPAN class="sec-title">Defining
additional fonts</SPAN></A></H4>
<P>If an application needs additional fonts, such fonts can be declared
using directives. The fourth initialisation argument of class
<A class="" href="summary.html#class:font">font</A> determines the
window-system font that will be mapped. The syntax for this argument
depends on the window-system used. For this Unix/X11 version it is a
string consisting of 15 `-' separated fields. A font can be searched
using <STRONG>xfontsel</STRONG>(1) or the much better GNOME-project <STRONG>gfontsel</STRONG>(1).
<P>For example, the 14-points `courier new' TrueType font can be
registered using:
<PRE class="code">
:- initialization
new(_, font(courier, roman, 14,
'-winfonts-courier new-medium-r-normal-*-*-140-*-*-m-*-iso8859-1')).
</PRE>
<P>This specification has various drawbacks. For example, another
library or application loaded on top of the same <font size=-1>XPCE</font>
process may be using the symbol,roman,14 specification, but bound to
another window-system font. A user may try to run your application on an
environment that does not have this font. Part of these problems can be
eliminated by binding the font to a logical font name. See also <A class="sec" href="font.html">section
10.9.2</A>.
<PRE class="code">
:- initialization
send(@display, font_alias,
adobesymbol,
font(symbol, roman, 14,
'-*-symbol-*-*-*-*-14-*-*-*-*-*-adobe-*')).
</PRE>
<P>The application will refer to this font using the font-alias. user
has other preferences or the font is not available, the user may specify
the font using the display.user_fonts class-variable described in <A class="sec" href="font.html">section
10.9.2</A>.
<H3><A NAME="sec:10.9.2"><SPAN class="sec-nr">10.9.2</SPAN> <SPAN class="sec-title">Logical
fonts</SPAN></A></H3>
<A NAME="sec:fontalias"></A>.
<P>It is not wise let your application code speak about physical fonts
as the user or interface guidelines may prefer using a different
font-palette. For this reason the display defines a mapping between
logical font names and physical fonts. Applications are encouraged to
use logical font names as much as possible and leave the assignment to
physical fonts to the users preferences. <font size=-1>XPCE</font>
predefines the following logical font-names. The value gives the default
assignment for these fonts.
<P>
<UL>
<DT><CODE>normal</CODE><I>font(helvetica, roman, 12)</I></DT>
<DD class="defbody">
The default font. Normally a proportional roman font. Should be easy to
read.
</DD>
<DT><CODE>bold</CODE><I>font(helvetica, bold, 12)</I></DT>
<DD class="defbody">
Bold version of the normal font.
</DD>
<DT><CODE>italic</CODE><I>font(helvetica, oblique, 12)</I></DT>
<DD class="defbody">
Slanted version of the normal font. Note that italic fonts should not be
used for long text as italics is generally not easy to read on most
displays.
</DD>
<DT><CODE>small</CODE><I>font(helvetica, roman, 10)</I></DT>
<DD class="defbody">
Small version of the normal font. To be used in notes, subscripts, etc.
May not be so easy to read, so avoid using it for long texts.
</DD>
<DT><CODE>large</CODE><I>font(helvetica, roman, 14)</I></DT>
<DD class="defbody">
Slightly larger version of the normal font.
</DD>
<DT><CODE>boldlarge</CODE><I>font(helvetica, bold, 14)</I></DT>
<DD class="defbody">
Bold version of large.
</DD>
<DT><CODE>huge</CODE><I>font(helvetica, roman, 18)</I></DT>
<DD class="defbody">
Even larger font. To be used for titles, etc.
</DD>
<DT><CODE>boldhuge</CODE><I>font(helvetica, bold, 18)</I></DT>
<DD class="defbody">
Bold version of huge.
</DD>
<DT><CODE>fixed</CODE><I>font(screen, roman, 13)</I></DT>
<DD class="defbody">
Terminal font. To be used for code fragments, code editors, etc. Should
be easy to read.
</DD>
<DT><CODE>tt</CODE><I>font(screen, roman, 13)</I></DT>
<DD class="defbody">
Same as <CODE>fixed</CODE>.
</DD>
<DT><CODE>boldtt</CODE><I>font(screen, bold, 13)</I></DT>
<DD class="defbody">
Bold terminal font.
</DD>
<DT><CODE>symbol</CODE><I>font(symbol, roman, 12)</I></DT>
<DD class="defbody">
Symbol font using the adobe symbol-font encoding. This font provides
many <A NAME="idx:mathematicalsymbols:431">mathematical symbols</A>.
</UL>
<P>The end-user of an <font size=-1>XPCE</font> application can define
the class-variable display.user_fonts to overrule fonts. The example
below re-binds the most commonly used fonts to be slightly larger and
choose from the Times font family rather than the Helvetica fonts.
<PRE class="code">
display.user_fonts: \
[ normal := font(times, roman, 14), \
bold := font(times, bold, 14), \
italic := font(times, italic, 14) \
]
</PRE>
<P>The mapping between logical font names and physical fonts is realised
by the methods <A NAME="idx:displaybothfontalias:432"></A>`<B>display<CODE><-></CODE>font_alias</B>'
additional font aliases may be loaded using <A NAME="idx:displaysendloadfontaliases:433"></A>`<B>display<CODE>-></CODE>load_font_aliases</B>'.
<P>Class <A class="" href="summary.html#class:font">font</A>'s
predefined conversion will translate names to font objects. This implies
that for any method expecting a font object the programmer can specify
the font-name instead. In those (rare) cases where a font needs to be
passed, but the type-specification does not require this, the conversion
must be done explicitly. The preferred way to make the conversion is
using the font type object:
<PRE class="code">
...,
get(type(font), check, bold, BoldFont),
...,
</PRE>
<P></BODY></HTML>
|