Re: [docbook-apps] Odd Characters in UTF-8, Docbook 5.1

From
<>
Date
2017-02-03T01:38:23+00:00
ID
Thread
Re: [docbook-apps] Odd Characters in UTF-8, Docbook 5.1
I use DejaVu fonts with FOP on both Windows and Linux.

 

I use my own config file via "-c configFile.xml" switch with FOPs command 
line to override the standard config. The integration with DejaVu fonts is 
pretty straight forward.

 

This may help you - attached is part of the script that I use on Linux to 
call FOP and also the configuration file.

 

You should be able to comment out the DejaVu parts of the config file and 
see your fonts return to default. If not, I would check the fop script that 
starts FOP.  (using 'which fop' to locate it)

 

Good luck.

 

Dean Nelson

 

 

In a message dated 2/2/2017 2:19:16 P.M. Pacific Standard Time, 
 writes:

  
This is turning out to be odd...I have to conclude that fop is not 
  reading any configuration files...especially none named "fop.xconf". The short 
  story is that I can intentionally introduce errors in fop.xconf (all 
  occurrences on the computer as verified by updatedb and locate .xconf), 
  introduce "<strict-configuration>true</strict-configuration>", and 
  no mention of anything different occurs. I can run this under strace, and I 
  see no calls at all referring to opening any xconf file (nor any attempt to do 
  so). Somehow I need to figure out how fop is configured since the installed 
  xconf files are ignored.

  
 

  
Here's a summary of how I go there:

  
 

  
The DejaVuSans fonts do contain the character glyphs, and this is what 
  I've been trying to switch to instead of Helvetica for the sans-serif.

  
 

  
It was determined that param.xsl picks between serif and sans-serif by 
  naming one of these:

  
<xsl:param name="body.font.family">serif</xsl:param>

  
<xsl:param 
  name="body.font.family">sans-serif</xsl:param>

  
 

  
When changing between serif and sans-serif vi param.xsl edits, it is 
  verified that that either Times or Helvetica are used upon switch. This works 
  as expected.

  
 

  
I added the fop option "-d" to debug...this did not indicate any error, 
  though it was more explicit about not finding glyphs. After that I tried the 
  strict-configuration modification. No change. I looked for any possible 
  occurrence of fop.xconf, these two exist (I don't know how they differ), I 
  intentionally tried to break both for warning information:

  
/usr/share/fop/conf/fop.xconf
/usr/share/publican/fop/fop.xconf
 

  
This had no effect, so this is when I tried strace. It seems fop does not 
  use external configuration file searches, and I don't know why...so I can't 
  actually add DejaVuSans. I'm currently trying to figure out where there is a 
  mailing list or other support for fop. Incidentally, the "fop -x" command to 
  dump configuration fails...it wants an input file or it won't tell me anything 
  about configuration.

  
 

  
Thanks everyone for the help!

  
 

  
----- Original Message -----
From: Dave Pawson 
  <>
To: Richard Hamilton 

  <>
Cc: , Docbook 
  <>
Sent: Thu, 02 Feb 2017 06:37:36 
  -0000 (UTC)
Subject: Re: [docbook-apps] Odd Characters in UTF-8, Docbook 
  5.1

  

  
Perhaps start where the problem is. Look for a font which contains
the 
  glyphs for the Unicode code points you want to use. Check the
code points 
  produce the glyphs you want.
Find out how the app (fop and any others you 
  use in your tool chain)
selects fonts.
Run the app knowing that the font 
  has what you want and your code
points are correct.

  

  
HTH

  

  
On 1 February 2017 at 23:44, Richard Hamilton 
  <> wrote:
> I’m getting out of my depth on 
  fop, so maybe someone else on the list can help here.
>
> However, 
  diving in deeper than I should:-)I suspect the problem is number 
  1.
>
> I suggest running fop with the -d (debug) mode, and you 
  might also try -x, which will dump the configuration; that way you can see if 
  the configuration fop uses is what you think it is using.
>
> Good 
  luck,
> Dick
> -------
> XML Press
> XML for Technical 
  Communicators
> http://xmlpress.net
> 
  
>
>
>
>> On Feb 1, 2017, at 
  15:21,  wrote:
>>
>> 
  Hi,
>>
>> So what my experimenting shows so far for trying 
  to change font is that I can adjust param.xsl and switch between serif or 
  sans-serif. The result depends on what is available in fop.xconf which lists 
  Times-Roman for serif, and Helvetica for sans-serif. I've attempted to add an 
  additional font definition for DejaVuSans by the following inside the 
  <fonts> of fop.xconf:
>>
>> <!-- DejaVuSans 
  -->
>> <font 
  embed-url="">
>> 
  <font-triplet name="DejaVuSans" style="normal" 
  weight="normal"/>
>> </font>
>>
>> I am 
  unable to name "DejaVuSans" instead of "sans-serif" in param.xsl (it falls 
  back to Symbol). I see three possibilities...
>> 1. My DejaVuSans 
  declaration is wrong.
>> 2. I have to remove Helvetica in fop.xconf 
  from the sans-serif listings.
>> 3. The Docbook parameters you 
  mentioned are somewhere outside of fop.xconf or 
  param.xsl.
>>
>> It seems unlikely I need to remove 
  Helvetica, more likely there is another configuration elsewhere. However, I 
  don't see any occurrence of "Helvetica" in any of the other Docbook files 
  under the "stylesheet/docbook-xsl-ns-1.79.1/" directory tree which are related 
  to this case (for example, there is a subdirectory for "slides" which would 
  seem to be unrelated to the "book" being published to pdf). The full path to 
  the ttf font file is available and readable to everyone; this is verifiable 
  with a font editor (one reason to choose DejaVu is that the font editor 
  actually shows the desired box drawing font glyphs at index 0x2500 and 
  on).
>>
>> Am I missing another file to edit, or am I simply 
  using the wrong syntax for my addition of DejaVuSans?
>>
>> 
  Thanks!
>>
>> ----- Original Message -----
>> From: 
  Richard Hamilton <>
>> To: 
  
>> Cc: Docbook 
  <>
>> Sent: Wed, 01 Feb 2017 
  20:36:59 -0000 (UTC)
>> Subject: Re: [docbook-apps] Odd Characters in 
  UTF-8, Docbook 5.1
>> Hi,
>> There are two steps to the font 
  assignment process: 1) configuring fop’s fonts and 2) setting DocBook 
  parameters to call the fonts you have configured in fop.
>> In this 
  case, the mapping between serif and Times (and sans-serif and Helvetica) 
  happens in the fop configuration file, fop.xconf.
>> So, when you set 
  the DocBook parameter to sans-serif, fop defaults to Helvetica. If you want 
  sans-serif to default to something else, or if you want to add a font, you 
  need to change the configuration in fop.xconf. Once you have configured fop to 
  recognize a font, you can refer to it from the DocBook parameters using the 
  name you have associated with the font in fop.xconf. If you look in your 
  fop.xconf file, you will find that the definition for Times contains several 
  instances of the <font-triplet> element, each of which defines a name 
  you can use for that font, along with information about style and 
  weight.
>> This page has some information on configuring the 
  fop.xconf file for fonts:
>> 
  https://xmlgraphics.apache.org/fop/2.1/fonts.html
>> Best 
  regards,
>> Dick Hamilton
>> -------
>> XML 
  Press
>> XML for Technical Communicators
>> 
  http://xmlpress.net
>> 
>> > On Feb 
  1, 2017, at 11:53,  wrote:
>> >
>> 
  > Hi,
>> >
>> > I tested this by changing 
  body.font.family to sans-serif. The document did successfully switch, and used 
  Helvetica. Unfortunately, Helvetica also lacks the box drawing characters. Is 
  there a configuration file used for a given Docbook 5.1 installation which 
  maps "Times Roman" to serif, and "Helvetica" to sans-serif? I think this is 
  the key to getting those box drawing characters to work...perhaps if I can 
  remap serif and sans-serif to valid fonts other than Helvetica and Times Roman 
  it would work with those characters.
>> >
>> > 
  Thanks!
>> >
>> > ----- Original Message 
  -----
>> > From: Bob Stayton <>
>> 
  > To: , 
>> 
  > Sent: Wed, 01 Feb 2017 18:51:04 -0000 (UTC)
>> > Subject: Re: 
  [docbook-apps] Odd Characters in UTF-8, Docbook 5.1
>> > 
  Hi,
>> > If by system-wide you mean everyone sharing one DocBook 
  XSL
>> > installation, you could edit the parameters file for that 
  installation.
>> > Find the file named fo/param.xsl and change 
  these stylesheet parameters:
>> > <xsl:param 
  name="body.font.family">serif</xsl:param>
>> > 
  <xsl:param 
  name="title.font.family">sans-serif</xsl:param>
>> > All 
  of the stylesheet params are documented here:
>> > 
  http://docbook.sourceforge.net/release/xsl/current/doc/fo/index.html
>> 
  >
>> > Bob Stayton
>> > Sagehill 
  Enterprises
>> > 
>> > On 2/1/2017 
  10:22 AM,  wrote:
>> > > I just wanted to 
  add some information from reading build logs for the
>> > > 
  document. It turns out the error shows up under "fop" because the
>> 
  > > particular font does not support this character (I'm 
  surprised
>> > > Times-Roman does not have this by default 
  since just about every
>> > > application on the system has the 
  character):
>> > > WARNING: Glyph "├" (0x251c, SF080000) not 
  available in font "Times-Roman".
>> > >
>> > > 
  The trouble here is I now want to change this for the system as a 
  whole,
>> > > not just on the document (I want to avoid any 
  project using
>> > > Times-Roman). I am curious if there is 
  some simple way under Linux to
>> > > find out which fonts fop 
  has available, and how to change the default
>> > > font family 
  for all Docbook publishing via a system-wide setting? I've
>> > 
  > found many documents on modifying Docbook behavior within source 
  code,
>> > > but not much seems to exist on system-wide Docbook 
  configuration from a
>> > > system administrator's point of 
  view...if anyone has a URL for
>> > > information on specifics 
  of tuning Docbook defaults under Linux I'd be
>> > > very 
  happy!
>> > >
>> > > Thanks!
>> > 
  >
>> > > ----- Original Message -----
>> > > 
  From: 
>> > > To: 
  
>> > > Sent: Tue, 31 Jan 2017 
  23:20:24 -0000 (UTC)
>> > > Subject: [docbook-apps] Odd 
  Characters in UTF-8, Docbook 5.1
>> > > Hi,
>> > 
  >
>> > > I'm working on a Linux machine which has UTF-8 
  encoding. The docbook 5.1
>> > > I'm working with is 
  declared:
>> > > <?xml version="1.0" 
  encoding="utf-8"?>
>> > > <!DOCTYPE book [
>> 
  > > <!ENTITY version "0.1 unreleased">
>> > > 
  ]>
>> > >
>> > > Entities changed a while 
  back (relaxng changed things), but so far as I
>> > > know I 
  should still be able to work with numeric entities when using odd
>> 
  > > characters which are part of UTF-8. I'm trying to get some box 
  drawing
>> > > characters to work, specifically because I need 
  to illustrate a file
>> > > directory structure which has been 
  output like this from the "tree -d"
>> > > command. Here's a 
  short sample:
>> > >> tree -d -L 2 /etc | tail -n 20 | tail 
  -n 6
>> > > │ ├── pluginconf.d
>> > > │ ├── 
  protected.d
>> > > │ └── vars
>> > > └── 
  yum.repos.d
>> > >
>> > > As you can see the 
  vertical and horizontal box drawing characters are
>> > > used. 
  When I redirect this to a file or copy and paste into the document
>> 
  > > all I get is a substitute...each shows as "#". So I tried to use 
  numeric
>> > > entities instead. As an example "boxh" 
  (horizontal box line) should work
>> > > as "&#x2500;". 
  This does not work, and rendering still ends up as "#". I
>> > 
  > tried the numeric code for the plus/minus character, "|&#x00B1;|", 
  and
>> > > this does work. I don't know if it proves anything, 
  but since my UTF-8
>> > > terminal shows all of the above 
  characters just fine on a terminal, it
>> > > seems like the 
  ability to output is not in question...perhaps this is an
>> > 
  > invalid assumption.
>> > >
>> > > Btw, one 
  reference on the Unicode numeric value is from:
>> > > 
  http://www.oasis-open.org/docbook/documentation/reference/html/iso-box.html
>> 
  > >
>> > > Under Docbook 5.1, what do I need to do to use 
  this numeric entity other
>> > > than using UTF-8 and the 
  numeric entity syntax? Is there an additional
>> > > XML 
  declaration I need?
>> > >
>> > > 
  Thanks!
>
>
> 
  ---------------------------------------------------------------------
> 
  To unsubscribe, e-mail: 
> 
  For additional commands, e-mail: 
  
>

  

  

  

  
-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook 
  FAQ.
http://www.dpawson.co.uk

Attachment:
fop-config.zip

Description: Zip archive