aboutsummaryrefslogtreecommitdiffstats
path: root/lib/gs/doc/src/gs_chapter5.xmlsrc
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/gs/doc/src/gs_chapter5.xmlsrc
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/gs/doc/src/gs_chapter5.xmlsrc')
-rw-r--r--lib/gs/doc/src/gs_chapter5.xmlsrc69
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/gs/doc/src/gs_chapter5.xmlsrc b/lib/gs/doc/src/gs_chapter5.xmlsrc
new file mode 100644
index 0000000000..fb60272598
--- /dev/null
+++ b/lib/gs/doc/src/gs_chapter5.xmlsrc
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>Fonts</title>
+ <prepared></prepared>
+ <docno></docno>
+ <date></date>
+ <rev></rev>
+ <file>gs_chapter5.xml</file>
+ </header>
+
+ <section>
+ <title>The Font Model</title>
+ <p>Text related objects can be handled with the font option <c><![CDATA[{font,Font}]]></c>. A <c><![CDATA[Font]]></c> is represented as a two or three tuple:</p>
+ <list type="bulleted">
+ <item><c><![CDATA[{Family,Size}]]></c></item>
+ <item><c><![CDATA[{Family,Style,Size}]]></c></item>
+ </list>
+ <p>Examples of fonts are: <c><![CDATA[{times,12}]]></c>, <c><![CDATA[{symbol,bold,18}]]></c>, <c><![CDATA[{courier,[bold,italic],6}]]></c>, <c><![CDATA[{screen,12}]]></c>.</p>
+ <p>The most important requirement with the font model is to ensure that there is always a "best possible" font present. For example, if an application tries to use the font <c><![CDATA[{times,17}]]></c> on a computer system which does not have this font available, the <c><![CDATA[gs]]></c> font model automatically substitutes <c><![CDATA[{times,16}]]></c>.</p>
+ <p>Note that GS requires that the following fonts are available if using an X-server display:</p>
+ <list type="bulleted">
+ <item>fixed</item>
+ <item>-*-courier-*</item>
+ <item>-*-times-*</item>
+ <item>-*-helvetica-*</item>
+ <item>-*-symbol-*</item>
+ <item>"-*-new century schoolbook-"</item>
+ <item>-*-screen-*</item>
+ </list>
+ <p>To find out which font is actually chosen by the <c><![CDATA[gs]]></c>, use the option <c><![CDATA[{choose_font,Font}]]></c>. For example, the following situation might occur:</p>
+ <pre><![CDATA[
+1> <input>G=gs:start().</input>
+{1,<0.20.0>}
+2><input>gs:read(G,{choose_font,{times,38}}).</input>
+{times,[],38}
+3> <input>gs:read(G,{choose_font,{screen,italic,6}}).</input>
+{courier,italic,6}
+4>
+ ]]></pre>
+ <p>When programming with fonts, it is often necessary to find the size of a string which uses a specific font. <c><![CDATA[{font_wh,Font}]]></c> returns the width and height of any string and any font. The following example illustrates its usage:</p>
+ <marker id="gs_fig6"></marker>
+ <image file="images/ex15.gif">
+ <icaption>Font Examples</icaption>
+ </image>
+ <codeinclude file="examples/ex15.erl" tag="" type="erl"></codeinclude>
+ </section>
+</chapter>
+