Hello Philipp,

On 14/05/2010, at 3:38 AM, Philiрp Rеichmuth wrote:

Am Wed, 12 May 2010 10:55:47 +0300 schrieb Khaled Hosny:
Or, alternatively, just use the proper unicode character in your input
(though, I myself, find TeX notation a bit handy).

It would be even handier if it was easier to configure xunicode's glyph
replacement for precomposed characters.

It is easy. You simply undeclare any definitions that do not apply.
Currently Xunicode has the line:

  \DeclareUTFcomposite[\UTFencname]{x1E57}{\.}{p}

which maps  \.{p}  to Ux1E57

If you include a line, after Xunicode has loaded, as follows:

   \UndeclareUTFcomposite[\UTFencname]{x1E57}{\.}{p}

then now  \.{p}  will be mapped to the pair  'p'Ux0307
which just requires the font to have the combining dot-above accent.

If your font has neither the precomposed characters,
nor the combining accent, then yes there is a bit more to do.
But that is also possible, as Xunicode has a built-in
method to handle this too; viz.

\gdef\...@set@accentmod#1#2#3{\...@accent{"#3}{#2}}

\makeatletter
\let\...@encoded@accent\...@set@accentMOD
\DeclareEncodedCompositeCharacter{\UTFencname}{\.}{0307}{02D9} % Combining dot above
 ... more such declarations ...
\makeatother

Now you will get the non-combining character  Ux02D9  positioned
above the letter to be accented.


The  \DeclareEncodedCompositeCharacter  line can also
be found in  xunicode.sty , so you just copy it from there.



Currently I have a lot of \DeclareTextAccent in my preamble to customize
accents for fonts that don't have the necessary precomposed characters
together with \catcode declarations along the lines of
\catcode `ṗ = \active\let ṗ\pdotabove
\catcode `ʿ = \active\let ʿ\PRAin

OK. Xunicode has not assigned individual macro names to these
accented characters, because the old tipa.sty  did not do so.
Is there an active standard for these names ?

If not, you could use the same approach but define

  \catcode `ṗ = \active \def ṗ{\.{p}}

to use the  \...@set@accentMOD  method after redeclaring
how the \. accent will be formed.


That way I can supplement a lot of Unicode precomposed glyphs for fonts
that don't have them. It is workable and looks reasonably well in most
cases, but the preamble is a bit unwieldy and the text accents are a bit
hackish.

It would be nice to have more customization options for xunicode's
behaviour (no replacement, replacement with "proper" Unicode accent glyphs, replacement with similarly-looking glyphs such as macron -> dash, that sort
of thing).

Is this not exactly what I described above?

One of the reasons why I got into TeX in the first place was
that it was easy to use lots of different accents with standard fonts in printed output. XeTeX is very useful for Unicode, but it forces me again to
have glyphs for all the fonts or to get hackish.

You cannot call up glyphs in a font that doesn't have them.
So this kind of problem still arises. It isn't XeTeX's fault.


Now we come to the point of the  \UTFencname  parameter.

If you know what your font supports, then you can define
a specific encoding name for it.

e.g.

  \def\UTFencname{Pdot}
  \usepackage{xunicode}
  \makeatletter
   \let\...@encoded@accent\...@set@accentMOD
   \UndeclareUTFcomposite[\UTFencname]{x1E57}{\.}{p}
   % ... more \Undeclare...  combinations, if required
\DeclareEncodedCompositeCharacter{\UTFencname}{\.}{0307}{02D9} % Combining dot above
  \makeatother

Now you have a font-encoding that matches what your font supports.
If you used fontspec to load the main body font, then that still
works with the  EU1  encoding.

When you switch to use your special font, you need to include
  \fontencoding{Pdot}
with your font-switch macro.


While I am aware of the
limitations such as searching in PDFs, it would still be useful to
customize the replacements xunicode is doing at a higher level than
changing character encodings all the time.

This should only be necessary if you are using glyphs
from fonts that are not using the Unicode code-points.
If you are doing this, then it is /ActualText  that you
need, to get searching to work correctly.

That has been the topic of a recent thread:

     "Ligatures and searching in PDFs"




Philipp


Hope this helps,

        Ross

------------------------------------------------------------------------
Ross Moore                                       r...@maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
 http://tug.org/mailman/listinfo/xetex

Reply via email to