* Re: [9fans] eqn and unicode
@ 2009-05-28 23:06 Russ Cox
2009-06-01 22:45 ` erik quanstrom
0 siblings, 1 reply; 6+ messages in thread
From: Russ Cox @ 2009-05-28 23:06 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
On Thu, May 28, 2009 at 4:08 AM, Gregory Pavelcak
<g.pavelcak@comcast.net> wrote:
> If you write the eqn-word for a greek letter, "GAMMA" for
> example; eqn passes the unicode character (the output of
> Alt-*G) to troff. If, on the other hand, you type Alt-*G in eqn,
> it passes `"\f2Γ\fP' to troff, thus producing, by my lights anyway,
> a nicer looking character. I was just wondering if this was
> intended as a way to give people both a roman-greek letter
> and an italic one, or if it was intended to discourage the use
> of eqn's letter names in favor of unicode, or if it just sorta
> happened. Perhaps none of the above. Anyone know?
Eqn should not generate different output for GAMMA vs Γ.
Feel free to fix it.
Russ
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] eqn and unicode 2009-05-28 23:06 [9fans] eqn and unicode Russ Cox @ 2009-06-01 22:45 ` erik quanstrom 2009-06-02 11:41 ` Gregory Pavelcak 0 siblings, 1 reply; 6+ messages in thread From: erik quanstrom @ 2009-06-01 22:45 UTC (permalink / raw) To: 9fans On Thu May 28 19:07:48 EDT 2009, rsc@swtch.com wrote: > On Thu, May 28, 2009 at 4:08 AM, Gregory Pavelcak > <g.pavelcak@comcast.net> wrote: > > If you write the eqn-word for a greek letter, "GAMMA" for > > example; eqn passes the unicode character (the output of > > Alt-*G) to troff. If, on the other hand, you type Alt-*G in eqn, > > it passes `"\f2Γ\fP' to troff, thus producing, by my lights anyway, > > a nicer looking character. I was just wondering if this was > > intended as a way to give people both a roman-greek letter > > and an italic one, or if it was intended to discourage the use > > of eqn's letter names in favor of unicode, or if it just sorta > > happened. Perhaps none of the above. Anyone know? > > Eqn should not generate different output for GAMMA vs Γ. > Feel free to fix it. this is an interesting case. fonts are not applied to symbols in the resword table. the following fix does solve the problem with historical correctness. if the font is ugly, perhaps a better font is in order. :-) - erik diffy -c lookup.c /n/dump/2009/0601/sys/src/cmd/eqn/lookup.c:145,150 - lookup.c:145,204 "PSI", "Ψ", "chi", "χ", "CHI", "Χ", + + /* + * greek letters translate to themselves; this prevents + * fonts from being applied to Γ but not GAMMA + */ + "α", "α", + "Α", "Α", + "β", "β", + "Β", "Β", + "γ", "γ", + "Γ", "Γ", + "δ", "δ", + "Δ", "Δ", + "ε", "ε", + "Ε", "Ε", + "ω", "ω", + "Ω", "Ω", + "λ", "λ", + "Λ", "Λ", + "μ", "μ", + "Μ", "Μ", + "ν", "ν", + "Ν", "Ν", + "θ", "θ", + "Θ", "Θ", + "φ", "φ", + "Φ", "Φ", + "π", "π", + "Π", "Π", + "σ", "σ", + "Σ", "Σ", + "ξ", "ξ", + "Ξ", "Ξ", + "ζ", "ζ", + "Ζ", "Ζ", + "ι", "ι", + "Ι", "Ι", + "η", "η", + "Η", "Η", + "κ", "κ", + "Κ", "Κ", + "ρ", "ρ", + "Ρ", "Ρ", + "τ", "τ", + "Τ", "Τ", + "ο", "ο", + "Ο", "Ο", + "υ", "υ", + "Υ", "Υ", + "ψ", "ψ", + "Ψ", "Ψ", + "χ", "χ", + "Χ", "Χ", + "and", "\\f1and\\fP", "for", "\\f1for\\fP", "if", "\\f1if\\fP", ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] eqn and unicode 2009-06-01 22:45 ` erik quanstrom @ 2009-06-02 11:41 ` Gregory Pavelcak 2009-06-02 12:02 ` erik quanstrom 0 siblings, 1 reply; 6+ messages in thread From: Gregory Pavelcak @ 2009-06-02 11:41 UTC (permalink / raw) To: 9fans > On Thu May 28 19:07:48 EDT 2009, rsc@swtch.com wrote: >> On Thu, May 28, 2009 at 4:08 AM, Gregory Pavelcak >> <g.pavelcak@comcast.net> wrote: >> > If you write the eqn-word for a greek letter, "GAMMA" for >> > example; eqn passes the unicode character (the output of >> > Alt-*G) to troff. If, on the other hand, you type Alt-*G in eqn, >> > it passes `"\f2Γ\fP' to troff, thus producing, by my lights anyway, >> > a nicer looking character. I was just wondering if this was >> > intended as a way to give people both a roman-greek letter >> > and an italic one, or if it was intended to discourage the use >> > of eqn's letter names in favor of unicode, or if it just sorta >> > happened. Perhaps none of the above. Anyone know? >> >> Eqn should not generate different output for GAMMA vs Γ. >> Feel free to fix it. > > this is an interesting case. fonts are not applied to symbols > in the resword table. the following fix does solve the problem > with historical correctness. if the font is ugly, perhaps a better > font is in order. :-) > > - erik Hmm. I submitted a patch so that fonts would apply to resword rather than making it so that they don't apply to greek letters, and I'm not even sure I did that right. diff -c /sys/src/cmd/eqn/text.c /usr/gp/sys/src/cmd/eqn/text.c /sys/src/cmd/eqn/text.c:83,89 - /usr/gp/sys/src/cmd/eqn/text.c:83,90 else if (t == TAB) p = "\\t"; else if ((tp = lookup(restbl, p1)) != NULL) { - p = tp->cval; + sprintf(cs, "\\f%s%s\\fP", ftp->name, tp->cval); + p = cs; } else { lf = rf = 0; lastft = 0; Now I don't know what's right. What if, for example, you use "gfont H"? Shouldn't that really make Γ get passed to troff as "\fHΓ\fP"? Greg ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] eqn and unicode 2009-06-02 11:41 ` Gregory Pavelcak @ 2009-06-02 12:02 ` erik quanstrom 2009-06-02 16:42 ` Gregory Pavelcak 0 siblings, 1 reply; 6+ messages in thread From: erik quanstrom @ 2009-06-02 12:02 UTC (permalink / raw) To: 9fans > Hmm. I submitted a patch so that fonts would apply to resword > rather than making it so that they don't apply to greek letters, > and I'm not even sure I did that right. > > diff -c /sys/src/cmd/eqn/text.c /usr/gp/sys/src/cmd/eqn/text.c > /sys/src/cmd/eqn/text.c:83,89 - /usr/gp/sys/src/cmd/eqn/text.c:83,90 > else if (t == TAB) > p = "\\t"; > else if ((tp = lookup(restbl, p1)) != NULL) { > - p = tp->cval; > + sprintf(cs, "\\f%s%s\\fP", ftp->name, tp->cval); > + p = cs; > } else { > lf = rf = 0; > lastft = 0; > > Now I don't know what's right. What if, for example, you > use "gfont H"? Shouldn't that really make Γ get passed to > troff as "\fHΓ\fP"? i'm pretty sure that's wrong for reswords like "≥" or "and". a font change would also change the appearance of existing documents. my change also changes the appearance of existing documents, but only those that use the relatively- new unicode input. on the other hand, for Γ to be treated the same as G, one would need a new table gktbl() that would be added here /sys/src/cmd/eqn/text.c:85,91 else if ((tp = lookup(restbl, p1)) != NULL) { p = tp->cval; } else { + if (tp = lookup(gktbl, p1)) != NULL) + p = p1 = tp->cval lf = rf = 0; lastft = 0; nclass = NONE; /* get started with no class == no pad */ csp = cs; one would also need to modifiy isalpharune to return true for greek letters. or just use the system isalpharune. i'm sure one could find a number of other bugs. the reason i didn't suggest this is because it changes old documents. perhaps we should just take our lumps and fix the problem. - erik ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] eqn and unicode 2009-06-02 12:02 ` erik quanstrom @ 2009-06-02 16:42 ` Gregory Pavelcak 2009-06-02 16:58 ` erik quanstrom 0 siblings, 1 reply; 6+ messages in thread From: Gregory Pavelcak @ 2009-06-02 16:42 UTC (permalink / raw) To: 9fans erik, You're reply and some reflection convinced me that my first approach is just wrong. I don't understand the next-to-last paragraph though. I tried creating gktbl and making the change you suggest to text.c, and it seems to work. Why does isalpharune() need changing? Greg > i'm pretty sure that's wrong for reswords like "≥" or "and". > a font change would also change the appearance of existing > documents. my change also changes the appearance of > existing documents, but only those that use the relatively- > new unicode input. > > on the other hand, for Γ to be treated the same as G, > one would need a new table gktbl() that would be added > here > > /sys/src/cmd/eqn/text.c:85,91 > else if ((tp = lookup(restbl, p1)) != NULL) { > p = tp->cval; > } else { > + if (tp = lookup(gktbl, p1)) != NULL) > + p = p1 = tp->cval > lf = rf = 0; > lastft = 0; > nclass = NONE; /* get started with no class == no pad */ > csp = cs; > > one would also need to modifiy isalpharune to return > true for greek letters. or just use the system isalpharune. > i'm sure one could find a number of other bugs. > > the reason i didn't suggest this is because it changes old > documents. perhaps we should just take our lumps and > fix the problem. > > - erik ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [9fans] eqn and unicode 2009-06-02 16:42 ` Gregory Pavelcak @ 2009-06-02 16:58 ` erik quanstrom 0 siblings, 0 replies; 6+ messages in thread From: erik quanstrom @ 2009-06-02 16:58 UTC (permalink / raw) To: 9fans > erik, > > You're reply and some reflection convinced me that my first > approach is just wrong. I don't understand the next-to-last > paragraph though. I tried creating gktbl and making the change > you suggest to text.c, and it seems to work. Why does > isalpharune() need changing? in trans(), there are two calls to isalpharune. since i think the point here is to say that greek (at least) letters are on par with roman letters, they should get the same shimming. there seems to be some deep magic with 'f' and 'j'. i'd be very intersted if anyone knows why they are exceptional. - erik ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-02 16:58 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-05-28 23:06 [9fans] eqn and unicode Russ Cox 2009-06-01 22:45 ` erik quanstrom 2009-06-02 11:41 ` Gregory Pavelcak 2009-06-02 12:02 ` erik quanstrom 2009-06-02 16:42 ` Gregory Pavelcak 2009-06-02 16:58 ` erik quanstrom
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).