[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Re: Adding styles to DESC
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] Re: Adding styles to DESC |
Date: |
Sat, 12 Jun 2004 16:17:58 +0200 (CEST) |
> This is exactly what I'm hoping can be accomplished somehow with
> groff, but without major changes to the way groff functions
> presently. And without changing the way font/devps is currently set
> up. I worry that there are groff users who may have already rolled
> their own solutions to the family/weight/shape problem by working
> within the constraints groff currently imposes, and that any change
> to groff may break their setup.
There are nice tricks available. Consider this:
.fp \n[.fp] TimesRoman TR
.fp \n[.fp] TimesBold TB
.
.fp 0 dummy TR
.ft 0
.
.sty \n[.fp] Roman
.
.fam Times
.ft Roman \" -> TimesRoman = TR
LaTeX is doing something similar in its font definition files: The
external names are completely separated from the internal ones.
> > As trivial as the font selection mechanism in groff seems to be,
> > it can be tricky to catch errors, providing meaningful defaults
> > and warning messages.
>
> Indeed. The major issue, as I see it is: what constitutes a
> "meaningful default"? If a user calls .fam <m> when style <n> is
> active, but fam <m> has no style <n>, how should groff behave? By
> selecting a (hypothetical) first "style" that does exist for family
> <m>, or by reverting to a something like the dummy font?
You have to decide on the priority of the font selection parameters.
If `family' is stronger than `style', then any style of family <m>
will be a proper replacement if style <n> isn't available. You might
register a `fallback font' for a given family which is always used if
the user selects a nonexisting font shape.
In LaTeX you can provide substitutes for nonexisting font shapes in
the font definition files. Example: If the user asks for
Helvetica/Medium/Italic, which doesn't exist, he gets
Helvetica/Medium/Slanted because of a corresponding substitution
entry.
> > What do you think about adding two conditional tests like this:
> >
> > .if F <font> \" true if <font> can be found by troff --
> > \" the font isn't loaded
> > \" if <font> is a style, and the style is registered,
> > \" and <family> is the current family,
> > \" test whether concatenation of <family> and <font>
> > \" exists
>
> I like this a lot. But I'm thinking that what's also needed is a
> string-valued register containing the name of the current style,
> [...]
Good idea. This should be rather easy to implement, I think. Stay
tuned.
> > .if S <style> \" true if <style> has been registered, either via
> > \" the DESC file or with .sty
>
> Not sure I understand the need for this, but then I'm a bit
> brain-fried today. :)
You need this to check whether e.g.
.ft foo
selects a real font `foo' or a style `foo'. In the former case, the
font family is ignored which must be handled as a special case.
Werner