groff
[Top][All Lists]
Advanced

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

Re: [Groff] redefining symbols on a per-font basis


From: Werner LEMBERG
Subject: Re: [Groff] redefining symbols on a per-font basis
Date: Sat, 14 Feb 2015 08:30:41 +0100 (CET)

>> As a work-around, I suggest that you define a `font environment'
>> that sets up proper `.char' definitions as soon as you enter it.
>
> I don't follow.  The manual seems to indicate that .char definitions
> are global, not per-environment.  (Also, arbitrary environments
> don't always play well with historical macro packages that assume
> only the three traditional troff environments, so this may run into
> other issues as a generalized solution.)

Sorry for being imprecise.  I meant something like

  .FONT_ENV_START
  ...
  .FONT_ENV_END

with proper `.char' definitions and undefinitions.

>> On the other hand, something simple as
>>
>>   .char ( \fR(\fP
>>   .char ) \fR)\fP
>>
>>   .fam T
>>   \fIfoo (\,bar\/) baz\fP
>>
>>   .fam A
>>   \fIfoo (\,bar\/) baz\fP
>>
>> works just fine.  Isn't this sufficient?
>
> That is sufficient for some cases.  But it incorrectly turns bolding
> off when the style is bold or bold italic.

Try this code and see attached image :-)

----------------------------------------------------------------------

.ft I
.nr ft-I \n[.f]
.ft
.
.ft BI
.nr ft-BI \n[.f]
.ft
.
.ds ft-I-BI-0    \" neither I nor BI
.ds ft-I-BI-1 \fR\" I
.ds ft-I-BI-2 \fB\" BI
.
.char ( \
\R'fI-fBI ((\\n[.f] == \n[ft-BI]) * 2 + (\\n[.f] == \n[ft-I]))'\
\E*[ft-I-BI-\\n[fI-fBI]]\
(
.char ) \
\R'fI-fBI ((\\n[.f] == \n[ft-BI]) * 2 + (\\n[.f] == \n[ft-I]))'\
\E*[ft-I-BI-\\n[fI-fBI]]\
)

foo (bar)

.ft B
B: foo (bar)

.ft I
I: foo (bar)

.ft BI
BI: foo (bar)

.ft P
P: foo (bar)

----------------------------------------------------------------------

> And the more general problem of overriding glyphs on a font-specific
> basis goes beyond this parentheses example.  For instance, the Linux
> Libertine typeface defines old-style figures, but doesn't give them
> names in the font file, requiring them to be accessed via \N.  But
> the glyph numbers for these figures are different in each Libertine
> style, so a catch-all .char definition won't work.

Indeed.


    Werner

Attachment: n.pdf
Description: Adobe PDF document


reply via email to

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