Re: Rendering a custom glyph using pango
- From: Steve White <stevan white googlemail com>
- To: Ferdinand Ramirez <ramirez ferdinand yahoo com>
- Cc: gtk-i18n-list gnome org
- Subject: Re: Rendering a custom glyph using pango
- Date: Tue, 14 Feb 2012 13:29:05 +0100
Hi Ferdinand,
I'm not quite sure what you're trying to accomplish, but let me sort
out a couple of points for you.
(Pardon me for telling you stuff you already know.)
On Tue, Feb 14, 2012 at 3:59 AM, Ferdinand Ramirez
<ramirez ferdinand yahoo com> wrote:
> How can I control from C code the display of a random glyph that I have created and added to a ttf font file with a unicode value that is in the private user area? Say I have assigned the value 22222 and need to display the corresponding glyph. Can I also map a totally random code and get it to work?
>
> How does this work? Which code does the control go through?
>
A specific substitution of a character by some other glyph is usually
prescribed in TrueType/OpenType lookup tables of the font itself.
Font renderering software reads those tables and performs the
substitutions automatically.
There are a variety of kinds of substitutions: one-for-one,
one-for-many, many-to-one (ligatures),
they can be activated under various circumstances (text language,
surrounding letters, etc)
As to "random" substitution: do you really mean "random", meaning a
different glyph every time, or "arbitrary"?
If you mean "arbitrary", the answer is simple: make a substitution
lookup table in the font.
If you really mean "random", it happens there is a table just for that.
http://en.wikipedia.org/wiki/List_of_typographic_features#OpenType_Typographic_Features
However, I have never tried it, and doubt that many font renderers implement it.
As to using "C": that langage knows nothing about fonts. To even
discuss this, we need to know which graphics or font library for C you
are referring to (OK, you're using gtk...)
Please note: glyphs placed in slots in the Private Use areas should
*never* have Unicode values -- the encoding of all such letters should
be "-1", as they are not "encoded" by Unicode. They are referred to
internally by glyph *name*.
> On a related note, what if I want to display the same glyph in gtk text area or on a gtk label? How would I do that? I am able to do it for regular unicode values by setting the font but noticed that it does not work when I add the glyph to the private range and try to add the code from the private range to the buffer.
>
OK it looks like you're using the gtx libraries.
Note you should have a *very* strong reason for directly accessing
Private Use glyphs, as any characters not Unicode encoded are by
nature application-dependent, that is, they will not be recognized by
other applications than yours.
Consider prescribing the substitution in the font itself--see if that
works for you. Your font editor will provide facilities for setting
this up.
Search for "OpenType feature" and "OpenType Layout tag" for the
different kinds of lookups.
Cheers!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]