On 05/02/11 01:15, 1T3XT BVBA wrote:
> Op 1/05/2011 19:28, Larry Evans schreef:
>> Did an `svn update` then `ant execute` which got much fewer errors, 
>> but still got some suggesting a windows path expression (using c:) 
>> instaad of something more generic was used:
> That's documented on p374.
> 
> The rationale is that we make it easy for Windows users to run the code,
> whereas Linux users are smart enough to fix this problem.
> 
> Using the c:/windows/fonts/ path is the "simple" solution.
> The generic solution is explained from section 11.4.1 on (p374).
> 
Thanks for the reference.  However, the suggestion on that page
to look at:

  /usr/share/X11/fonts/

doesn't work for ubuntu, which I gather is typical for linux
distributions which sometimes (maybe often) don't have a
standard place to put things.  Anyway, I found the fonts here:

  /usr/share/fonts/truetype/msttcorefonts

I changed:

  book/src/part1/chapter02/DirectorPhrases2.java

by substituting:

  /usr/share/fonts/truetype/msttcorefonts

for:

  c:/windows/fonts/

in the 2 statements:
  timesbd = BaseFont.createFont(
    "c:/windows/fonts/timesbd.ttf",
     BaseFont.WINANSI, BaseFont.EMBEDDED);
  times = BaseFont.createFont(
    "c:/windows/fonts/times.ttf",
     BaseFont.WINANSI, BaseFont.EMBEDDED);

and that .java file now compiles without problem; however, I will
have to make similar changes to all files that have similar
errors.  Wouldn't providing a constant string, somewhere,
for the directory where the fonts are located make
the code more portable?  I mean something like the:

   public static final String RESULT =
"results/part1/chapter02/director_phrases_2.pdf";

only it would be:

  public static final String FONTSDIR
    = "c:/windows/fonts/";

for windows, and:

  public static final String FONTSDIR
    = "/usr/share/fonts/truetype/msttcorefonts/";

for ubuntu, and, as suggested on p. 374:

  public static final String FONTSDIR
    = "/Library/fonts/";

for Mac.  Also, this os specific code could be documented
in maybe a README.protability.txt file or something like
that.  It would be nice if the `mv clean install` command
could make this change automagically.  Software oackages made
with make usually have a configure script which is initially
run before make to handle this sort of os specific problems.
Is it possible for mvn to do something similar?

-regards,
Larry






------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to