Files
cdesktop/cde/doc/C/guides/progGuide/ch02.sgm
2013-08-29 19:46:29 -06:00

434 lines
20 KiB
Plaintext

<!-- $XConsortium: ch02.sgm /main/5 1996/09/08 19:36:17 rws $ -->
<!-- (c) Copyright 1995 Digital Equipment Corporation. -->
<!-- (c) Copyright 1995 Hewlett-Packard Company. -->
<!-- (c) Copyright 1995 International Business Machines Corp. -->
<!-- (c) Copyright 1995 Sun Microsystems, Inc. -->
<!-- (c) Copyright 1995 Novell, Inc. -->
<!-- (c) Copyright 1995 FUJITSU LIMITED. -->
<!-- (c) Copyright 1995 Hitachi. -->
<Chapter Id="PG.fonts.div.1">
<Title Id="PG.fonts.mkr.1">Integrating Fonts</Title>
<Para>Your application may be used by someone sitting at an X terminal, or by
someone at a remote workstation across a network. In these situations, the
fonts available to the user's X display from the X window server might be
different from your application's defaults, and some fonts may not be
available.</Para>
<Para>The standard interface font names defined by CDE are guaranteed to be
available on all CDE-compliant systems. These names do not specify actual
fonts. Instead, they are aliases that each system vendor maps to its best
available fonts. If you use only these font names in your application, you can
be sure of getting the closest matching font on any CDE-compliant system.</Para>
<Para>These standard interface font names are guaranteed to be available for all
locales, whereas the standard application font names are only guaranteed for
ISO Latin locales. See the man pages, <Command>DtStdInterfaceFontNames</Command> and <Command>DtStdAppFontNames</Command> for more information.</Para>
<InformalTable Id="PG.fonts.itbl.1" Frame="All">
<TGroup Cols="1">
<ColSpec Colname="1" Colwidth="4.0 in">
<TBody>
<Row Rowsep="1">
<Entry><Para><!--Original XRef content: 'Standard Interface Fonts18'--><XRef Role="JumpText" Linkend="PG.fonts.mkr.2"></Para></Entry>
</Row>
<Row Rowsep="1">
<Entry><Para><!--Original XRef content: 'Using Fonts in CDE Configuration Files20'--><XRef Role="JumpText" Linkend="PG.fonts.mkr.4"></Para></Entry>
</Row>
<Row Rowsep="1">
<Entry><Para><!--Original XRef content: 'Standard Application Fonts21'--><XRef Role="JumpText" Linkend="PG.fonts.mkr.5"></Para></Entry>
</Row>
</TBody>
</TGroup>
</InformalTable>
<Sect1 Id="PG.fonts.div.2">
<Title Id="PG.fonts.mkr.2">Standard Interface Fonts</Title>
<Sect2 Id="PG.fonts.div.3">
<Title>Default Font Names<IndexTerm>
<Primary>font names</Primary>
<Secondary>standard interface</Secondary>
</IndexTerm><IndexTerm>
<Primary>standard interface font names</Primary>
</IndexTerm><IndexTerm>
<Primary>font names, default</Primary>
</IndexTerm><IndexTerm>
<Primary>default font names</Primary>
</IndexTerm></Title>
<Para>The set of standard interface font names is defined by the XLFD field name
values described in
<!--Original XRef content: 'Table&numsp;2&hyphen;2'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.fonts.mkr.6">.</Para>
<Table Id="PG.fonts.tbl.1" Frame="Topbot">
<Title Id="PG.fonts.mkr.3">Field Name Values for Standard Interface Font Names</Title>
<TGroup Cols="3">
<ColSpec Colname="1" Colwidth="1.125 in">
<ColSpec Colname="2" Colwidth="1.5 in">
<ColSpec Colname="3" Colwidth="2.25 in">
<THead>
<Row>
<Entry><Para><Literal>Field</Literal></Para></Entry>
<Entry><Para><Literal>Value</Literal></Para></Entry>
<Entry><Para><Literal>Description</Literal></Para></Entry>
</Row>
</THead>
<TBody>
<Row>
<Entry><Para><Command>FOUNDRY</Command></Para></Entry>
<Entry><Para><Command>dt</Command></Para></Entry>
<Entry><Para>CDE name</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>FAMILY_NAME</Filename></Para></Entry>
<Entry><Para><Command>interface system</Command>
or <Command>interface user</Command></Para></Entry>
<Entry><Para>CDE standard interface font name</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>WEIGHT_NAME</Filename></Para></Entry>
<Entry><Para><Command>medium</Command> or <Command>bold</Command></Para></Entry>
<Entry><Para>Weight of the font</Para></Entry>
</Row>
<Row>
<Entry><Para><Command>SLANT</Command></Para></Entry>
<Entry><Para><Command>r</Command></Para></Entry>
<Entry><Para>Roman</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>SET_WIDTH</Filename></Para></Entry>
<Entry><Para><Command>normal</Command></Para></Entry>
<Entry><Para>Normal set width</Para></Entry>
</Row>
<Row>
<Entry><Para>SPACING</Para></Entry>
<Entry><Para>p or m</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>ADD_STYLE</Filename></Para></Entry>
<Entry><Para>size hint</Para><Para><Command>sans</Command> or <Command>serif</Command></Para></Entry>
<Entry><Para>Proportional or Monospace values
from xxs to xxl</Para><Para>Sans for sans serif font or
serif for serif</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>PIXEL_SIZE</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>POINT_SIZE</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>RESOLUTION_X</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>RESOLUTION_Y</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>AVERAGE_WIDTH</Filename></Para></Entry>
<Entry><Para><Command>m</Command></Para><Para>p</Para></Entry>
<Entry><Para>Monospace for user font</Para><Para>Proportional for system font</Para></Entry>
</Row>
<Row>
<Entry><Para><Command>NUMERIC FIELD</Command></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Filename>CHAR_SET_REGI
STRY</Filename></Para></Entry>
<Entry><Para>Locale Dependent</Para></Entry>
<Entry></Entry>
</Row>
<Row>
<Entry><Para><Command>ENCODING</Command></Para></Entry>
<Entry><Para>Locale Dependent</Para></Entry>
<Entry></Entry>
</Row>
</TBody>
</TGroup>
</Table>
</Sect2>
<Sect2 Id="PG.fonts.div.4">
<Title>Point Sizes for Standard Interface Fonts</Title>
<Para>The seven named point sizes for each of the three styles are prepend in the
<Filename>ADD_STYLE_NAME</Filename> field. The font XLFD patterns matching these names can
match a named size, not a numeric size. These named sizes are used because
the exact size of an interface font is less important than its nominal size, and
implementation differences for the hand-tuned interface fonts do not allow
common numeric point sizes to be assured across systems.</Para>
<Para>The seven nominal sizes are as follows:</Para>
<ProgramListing>xxs extra extra small
xs extra small
s small
m medium
l large
xl extra large
xxl extra extra large</ProgramListing>
<Para>The goal of these named sizes is to provide enough fonts to display a variety
monitor sizes and resolutions that CDE will run on, and the range of user
preferences for comfortably reading button labels, window titles and so forth,
can be accommodated in the GUI. Both the smallest size, xxs, and the largest
size, xxl, are meant to be reasonable sizes for displaying and viewing the CDE
desktop on common displays and X terminals; they are not meant to imply
either hard-to-read fine print or headline-sized display type.</Para>
</Sect2>
<Sect2 Id="PG.fonts.div.5">
<Title>Patterns for the Standard Interface Font Names</Title>
<Para>Using these values, the XLFD pattern</Para>
<ProgramListing>-dt-interface*-*</ProgramListing>
<Para>logically matches the full set of XCDE Standard Interface Font Names. (Note
that no specific X server behavior is implied).</Para>
<Para>For example, in Western locales, the full set of 21 CDE Standard Interface Font
Names can be represented:</Para>
<ProgramListing>-dt-interface system-medium-r-normal-*-*-*-*-*-*-*-iso8859-1
-dt-interface user-medium-r-normal-*-*-*-*-*-m-*-iso8859-1
-dt-interface user-bold-r-normal-*-*-*-*-*-m-*-iso8859-1</ProgramListing>
<Para>The full set of patterns in the <Filename>app-defaults</Filename> files for all seven system font
sizes is:</Para>
<ProgramListing>-dt-interface system-medium-r-normal-xxs*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-xs*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-s*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-m*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-l*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-xl*-*-*-*-*-*-*-iso8859-1
-dt-interface system-medium-r-normal-xxl*-*-*-*-*-*-*-iso8859-1</ProgramListing>
<Para>These patterns could be used in a resource file and will match the full CDE
Standard Interface Names for the iso Latin-1 locales on all CDE-compliant
systems. For more information, see the <Filename>DtStdInterfaceFontNames(5)</Filename> man
page.</Para>
</Sect2>
</Sect1>
<Sect1 Id="PG.fonts.div.6">
<Title Id="PG.fonts.mkr.4">Using<IndexTerm>
<Primary>fonts</Primary>
<Secondary>in configuration files</Secondary>
</IndexTerm><IndexTerm>
<Primary>configuration file</Primary>
<Secondary>fonts</Secondary>
</IndexTerm> Fonts in CDE Configuration Files</Title>
<Para>CDE specifies a set of generic standard application font names, in several sizes,
that can be used by applications running under CDE on all platforms. Each
CDE vendor maps the standard set of font names to its available fonts. The
mapping of font names to existing fonts may vary from vendor to vendor.</Para>
<Para>When you use the standard application font names in your <Filename>app-defaults</Filename>
files, you can use a single<IndexTerm>
<Primary>&lt;Filename>app-defaults&lt;Default Para Font> file</Primary>
</IndexTerm>
<Filename>app-defaults</Filename> file across all CDE platforms. If you
do not use the standard font names, you must supply a different <ComputerOutput>app-
defaults</ComputerOutput> files for each application on each CDE platform.</Para>
<Para>All CDE systems provide a set of 13 standard application font names, in at
least 6 sizes, that represent 12 generic design and style variations (serif and
sans serif), as well as a symbol font. These standard names are provided in
addition to the names of the fonts that the standard names are mapped to for a
particular CDE platform. An additional four standard font names&mdash;to allow
both serif and sans serif designs in a monospaced font&mdash;may also be provided
by CDE platform vendors.</Para>
<Para>These 13 font names are provided in CDE platforms for the locales using the<IndexTerm>
<Primary>ISO 8859-1 character set</Primary>
</IndexTerm><IndexTerm>
<Primary>character set ISO 8859-1</Primary>
</IndexTerm>
ISO 8859-1 character set. See the <Emphasis>Common Desktop Environment:
Internationalization Programmer's Guide</Emphasis> for information on using standard font
names in other locales.</Para>
</Sect1>
<Sect1 Id="PG.fonts.div.7">
<Title Id="PG.fonts.mkr.5">Standard Application Fonts</Title>
<Sect2 Id="PG.fonts.div.8">
<Title>Default Font Names<IndexTerm>
<Primary>font names, default</Primary>
</IndexTerm><IndexTerm>
<Primary>default font names</Primary>
</IndexTerm></Title>
<Para>The set of standard application default font names is defined by the XLFD field
name values described in
<!--Original XRef content: 'Table&numsp;2&hyphen;2'--><XRef Role="CodeOrFigureOrTable" Linkend="PG.fonts.mkr.3"></Para>
<Table Id="PG.fonts.tbl.2" Frame="Topbot">
<Title Id="PG.fonts.mkr.6">Field Name Values for Standard Application Font Names</Title>
<TGroup Cols="3">
<ColSpec Colname="1" Colwidth="1.5 in">
<ColSpec Colname="2" Colwidth="1.125 in">
<ColSpec Colname="3" Colwidth="2.375 in">
<THead>
<Row>
<Entry><Para><Literal>Field</Literal></Para></Entry>
<Entry><Para><Literal>Value</Literal></Para></Entry>
<Entry><Para><Literal>Description</Literal></Para></Entry>
</Row>
</THead>
<TBody>
<Row>
<Entry><Para><Command>FOUNDRY</Command></Para></Entry>
<Entry><Para><Command>dt</Command></Para></Entry>
<Entry><Para>CDE name</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>FAMILY_NAME</Filename></Para></Entry>
<Entry><Para><Command>application</Command></Para></Entry>
<Entry><Para>CDE standard application font name</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>WEIGHT_NAME</Filename></Para></Entry>
<Entry><Para><Command>medium</Command> or <Command>bold</Command></Para></Entry>
<Entry><Para>Weight of the font</Para></Entry>
</Row>
<Row>
<Entry><Para><Command>SLANT</Command></Para></Entry>
<Entry><Para><Command>r</Command></Para><Para><Command>i</Command></Para></Entry>
<Entry><Para>Roman</Para><Para>Italic</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>SET_WIDTH</Filename></Para></Entry>
<Entry><Para><Command>normal</Command></Para></Entry>
<Entry><Para>Normal set width</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>ADD_STYLE</Filename></Para></Entry>
<Entry><Para><Command>sans</Command></Para><Para><Command>serif</Command></Para></Entry>
<Entry><Para>Sans serif font</Para><Para>Serif font</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>PIXEL_SIZE</Filename></Para></Entry>
<Entry><Para><Filename>*</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>POINT_SIZE</Filename></Para></Entry>
<Entry><Para><Symbol Role="Variable">pointsize</Symbol></Para></Entry>
<Entry><Para>Point size of the desired font</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>RESOLUTION_X</Filename></Para></Entry>
<Entry><Para><Filename>*</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>RESOLUTION_Y</Filename></Para></Entry>
<Entry><Para><Filename>*</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>AVERAGE_WIDTH</Filename></Para></Entry>
<Entry><Para><Command>p</Command></Para><Para><Command>m</Command></Para></Entry>
<Entry><Para>Proportional</Para><Para>Monospace</Para></Entry>
</Row>
<Row>
<Entry><Para><Command>NUMERIC FIELD</Command></Para></Entry>
<Entry><Para><Filename>*</Filename></Para></Entry>
<Entry><Para>Platform dependent</Para></Entry>
</Row>
<Row>
<Entry><Para><Filename>CHAR_SET_REGISTRY</Filename></Para></Entry>
<Entry><Para><Filename>iso8859-1</Filename></Para></Entry>
<Entry><Para>Defining standards authority</Para></Entry>
</Row>
<Row>
<Entry><Para><Command>ENCODING</Command></Para></Entry>
<Entry><Para><Filename>1</Filename></Para></Entry>
<Entry><Para>Character set number</Para></Entry>
</Row>
</TBody>
</TGroup>
</Table>
<Para>.</Para>
<Para>The standard names are available using the regular X Windows XLFD font-
naming scheme. When properly specified with appropriate wildcards for the
platform-dependent fields, a CDE font name is guaranteed to open a valid,
corresponding platform-dependent font. The <Command>XLFD</Command> name returned from a call
to the Xlib <ComputerOutput>XListFont</ComputerOutput> function, however, is not guaranteed to be the same on
all CDE platforms.</Para>
<Para>Using these values, the XLFD pattern</Para>
<ProgramListing>-dt-application-*</ProgramListing>
<Para>matches the full set of CDE standard application font names on a given
platform. The pattern</Para>
<ProgramListing>-dt-application-bold-*-*-*-*-*-*-*-p-*-*-*-</ProgramListing>
<Para>matches the bold, proportionally spaced CDE fonts, both serif and sans serif.
And the pattern</Para>
<ProgramListing>-dt-application-*-*-*-*-*-*-*-*-m-*-*-*-</ProgramListing>
<Para>matches the monospaced fonts (whether serif or sans serif, or both).</Para>
<Para>The full set of CDE Standard Application Font Names can be represented as
follows:</Para>
<ProgramListing>-dt-application-bold-i-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-bold-r-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-medium-i-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-medium-r-normal-serif-*-*-*-*-p-*-iso8859-1
-dt-application-bold-i-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-bold-r-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-medium-i-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-medium-r-normal-sans-*-*-*-*-p-*-iso8859-1
-dt-application-bold-i-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-bold-r-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-i-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-*-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-*-*-*-*-p-*-dtsymbol-1</ProgramListing>
</Sect2>
<Sect2 Id="PG.fonts.div.9">
<Title Id="PG.fonts.mkr.7">Point Sizes<IndexTerm>
<Primary>font point sizes</Primary>
</IndexTerm><IndexTerm>
<Primary>point sizes</Primary>
</IndexTerm>
for Standard Application Fonts</Title>
<Para>The complete set of point sizes available for each of the standard application
font names is determined by the set of fonts shipped with a vendor's CDE
platform, whether bitmapped only or both bitmapped and scalable outline.
The minimum set of sizes required and available on all CDE platforms
corresponds to the standard sizes of bitmapped fonts that make up the default
mapping for X11R5: 8, 10, 12, 14, 18, and 24.</Para>
<Para>For example, the entire set of six sizes of the plain monospaced font can be
represented by the patterns:</Para>
<ProgramListing>-dt-application-medium-r-normal-*-80-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-100-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-120-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-140-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-180-*-*-*-m-*-iso8859-1
-dt-application-medium-r-normal-*-240-*-*-*-m-*-iso8859-1</ProgramListing>
<Para>These patterns match the corresponding standard font name on any CDE
platform, even though the numeric fields other than <Command>POINTSIZE</Command> may be
different on various platforms, and the matched fonts may be either serif or
sans serif, depending on how the vendor implemented the set of standard
names.</Para>
</Sect2>
<Sect2 Id="PG.fonts.div.10">
<Title Id="PG.fonts.mkr.8">Standard Application Font Names in app-defaults files<IndexTerm>
<Primary>font names</Primary>
<Secondary>standard application</Secondary>
</IndexTerm><IndexTerm>
<Primary>standard application font names</Primary>
</IndexTerm></Title>
<Para>You can code a single <ComputerOutput>app-defaults</ComputerOutput> file to specify font resources for your
application and use it across all CDE platforms. Because the parts of the
standard names that are defined are the same across different vendors'
platforms, you can specify these values in the resource specification in the
<ComputerOutput>app-defaults</ComputerOutput> file. However, you must use wildcards for the other fields
(<Filename>PIXEL_SIZE</Filename>, <Filename>RESOLUTION_X</Filename>, <Filename>RESOLUTION_Y</Filename>, and <Filename>AVERAGE_WIDTH</Filename>)
because they may vary across platforms. For example, to specify some of the
default resource needs for an application named <Command>appOne</Command>, you might use:</Para>
<ProgramListing>appOne*headFont: -dt-application-bold-r-normal-sans-*-140-*-*-p-*-iso8859-1
appOne*linkFont: -dt-application-bold-i-normal-sans-*-100-*-*-p-*-iso8859-1</ProgramListing>
<Para>As another example, suppose that <Command>appTwo</Command> running on a vendor's platform
defines two font resources for headings and hypertext links. <Command>appTwo</Command> uses a 14
point bold, serif font (Lucidabright bold) and a 12-point bold, italic sans serif
font (Lucida bold-italic). You would then change the font definition from:</Para>
<ProgramListing>apptwo*headingFont: -b&amp;h-lucidabright-bold-r-normal--20-140-100-100-p-127-iso8859-1
apptwo*linkFont: -b&amp;h-lucida-bold-i-normal-sans-17-120-100-100-p-96-iso8859-1</ProgramListing>
<Para>to:</Para>
<ProgramListing>apptwo*headingFont: -dt-application-bold-r-normal-serif-*-140-*-*-p-*-iso8859-1
apptwo*linkFont: -dt-application-bold-i-normal-sans-*-120-*-*-p-*-iso8859-1</ProgramListing>
<Para>in your <Filename>app-defaults</Filename> file. Even though you may not know the names of the
fonts on other CDE platforms, these platform-independent patterns specified
with the CDE standard application font names match appropriate fonts on
each platform.</Para>
<Para>You encode them exactly as shown, complete with the <Filename>*</Filename> wildcards, in your
resource definitions. By applying the wildcards to the numeric fields other than
point size, you ensure that the resources match CDE fonts on all platforms,
even if the exact pixel size or average width of the fonts is slightly different.</Para>
<Para>See the <Emphasis>Common Desktop Environment Programmer's Reference</Emphasis> and <Command>DtStdAppFontNames(5)</Command> man page for more information.</Para>
</Sect2>
</Sect1>
</Chapter>
<!--fickle 1.14 mif-to-docbook 1.7 01/02/96 09:54:57-->