9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "rob pike" <rob@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Font behaviour
Date: Tue,  5 Feb 2002 12:22:07 -0500	[thread overview]
Message-ID: <34fa0649f0edeb10b2f67a3a4f9f71fc@plan9.bell-labs.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1449 bytes --]

The library forbids zero-width characters because of two issues:
1) they introduce ambiguities into the selection and placement rules,
in particular confusing the algorithm for character-at-position.
2) someone could print an unending stream of zero-width characters
and fill up memory.

One could argue that neither of these is a serious issue, and that
both are raised somewhat by overstriking, which we do accept (badly, at
least in rio), but I was troubled by them anyway.  Plan 9's font code
is quite primitive compared to what some systems do (and some
languages require), but it's served well enough for our purposes.  The
solution I concocted for zero-width characters struck me as rather
elegant, although I knew it would cause trouble for anyone who
legitimately had a use for them.

1) characters absent from the font are by definition zero-width.
2) all zero width characters are rendered as PJWs.

In a stroke, this made sparse Unicode fonts bearable.

You can take out the code that does this, but I think you'll raise some
other issues because of other code that depends on those properties.
A better solution might be to write a special operator that always draws
the character - it's a trivial call to draw().

The real solution is a complete redesign of the character handling model
to deal with all languages, right-to-left, Arabic letter-form-mutations,
etc. etc.  It's beyond my knowledge.

-rob


[-- Attachment #2: Type: message/rfc822, Size: 2261 bytes --]

From: Graham Gallagher <gg@acm.org>
To: 9fans@cse.psu.edu
Subject: [9fans] Font behaviour
Date: Wed, 06 Feb 2002 03:39:14 +1100
Message-ID: <3C600AB2.128AC713@acm.org>

I've been creating a range of fonts via a truetype to font(6) bitmap
generator I wrote.

One thing I noticed was that when trying to render characters possessing
a zero width escapement value, they were transmogrified into PJW. This
is really annoying because some glyphs, Thai vowels and tones for
instance, are intentionally designed to have zero width escapement
vectors for ease of placement.

Investigation of loadchar() in libdraw/font.c (image/font.c under
Inferno) reveals that indeed a test is made to check for zero width
characters. Is there a reason why this test can't be removed?

             reply	other threads:[~2002-02-05 17:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-05 17:22 rob pike [this message]
2002-02-06  9:33 ` Douglas A. Gwyn
2002-02-06 10:52   ` Boyd Roberts
  -- strict thread matches above, loose matches on Subject: below --
2002-02-08  1:06 okamoto
2002-02-08  9:58 ` Douglas A. Gwyn
2002-02-06 12:53 rob pike
2002-02-06 13:03 ` Boyd Roberts
2002-02-07  9:56   ` Douglas A. Gwyn
2002-02-07 10:43     ` Boyd Roberts
2002-02-06 12:16 rob pike
2002-02-05 16:39 Graham Gallagher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34fa0649f0edeb10b2f67a3a4f9f71fc@plan9.bell-labs.com \
    --to=rob@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).