groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allowing \N to accept hex numbers?


From: Oliver Corff
Subject: Re: Allowing \N to accept hex numbers?
Date: Mon, 18 Jan 2021 13:35:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

Hi Dorai,

oops, I did neither anticipate or expect such a behaviour (and use
case). I am sorry.

The question is if whether you intend to access the complete Dingbats
font in this way or just a few characters in it.

If you need every single character of the font, my suggestion for a
workaround will be clumsy, but if it is just a few characters, you can
define one or more strings as in the following example for letter 0x41
(uppercase A).

.\" Define String equivalent from hex input to target output:
.\" This example is ASCII uppercase A first in hex, then in decimal notation
.ds 41 65
.\" Use that string as argument to \N
\N'\*[41]' \" will print char 0x41, or "A"

This is my humble suggestion for a workaround; the elegant way would be
a small function that returns the decimal value of a hex input as to
cover all characters of that font.

If you need just a handful of characters, I think this is the easiest
way; you can pack all ".ds hex dec" definitions in a small file which
you call with
.so myhextodec_lut.roff

Oliver.


On 18/01/2021 02:53, ds26gte--- via wrote:
  I'm trying to access a code point in a non-Unicode font, namely the ITC Zapf 
Dingbats font that comes with groff. E.g., the code point 0x6E in Dingbats is a 
black square, and so far I see no way of using the hex number directly to 
typeset a black square. I have to convert it to 110 decimal, e.g., 
\f(ZD\N'110'\fP.

Following your message, I tried using \f(ZD\[u006E]\fP, but no dice. U+006E is of course 
n, and groff tries to find "special character \n", even though the prevailing 
font when \[u006E] is being invoked is a non-Unicode font.

--d

      On Sunday, January 17, 2021, 05:46:30 PM EST, Oliver Corff 
<oliver.corff@email.de> wrote:

  Hi Dorai,

is there any constraint that forces you to use \N, or can you use other
expressions as well? In that case, \[uxxxx] might be the desired answer
for you, where xxxx is a hex representation of a Unicode code point.

Oliver.


On 17/01/2021 19:34, Dorai Sitaram wrote:
\N'num' takes a number num and typesets the glyph corresponding to the code 
point num in the prevailing font. Currently, num can only be in decimal format. 
Is there a downside to allowing hex numbers, with the usual distinguishing 
prefix 0x?

--d





reply via email to

[Prev in Thread] Current Thread [Next in Thread]