After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 135697 - (pangographite) support for SILGraphite in the library
(pangographite)
support for SILGraphite in the library
Status: RESOLVED OBSOLETE
Product: pango
Classification: Platform
Component: general
unspecified
Other Linux
: High enhancement
: Medium feature
Assigned To: pango-maint
pango-maint
Depends on: 323661
Blocks:
 
 
Reported: 2004-02-28 17:09 UTC by Daniel Glassey
Modified: 2015-04-30 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add PANGO_SCRIPT_PREFERRED (1.29 KB, patch)
2004-02-28 17:10 UTC, Daniel Glassey
none Details | Review
modifications to use PANGO_SCRIPT_PREFERRED (2.10 KB, patch)
2004-02-28 17:24 UTC, Daniel Glassey
none Details | Review
mods to build system to add graphite module (2.24 KB, patch)
2005-12-09 18:01 UTC, Daniel Glassey
none Details | Review
graphite module (12.17 KB, application/x-compressed-tar)
2005-12-09 18:02 UTC, Daniel Glassey
  Details
mods to build system to add graphite module (3.19 KB, patch)
2006-02-02 23:48 UTC, Daniel Glassey
none Details | Review
graphite module directory (4.03 KB, application/x-compressed-tar)
2006-02-02 23:51 UTC, Daniel Glassey
  Details
Build system additions for graphite (3.36 KB, patch)
2006-07-18 17:08 UTC, Daniel Glassey
none Details | Review
graphite module directory (12.42 KB, application/x-compressed-tar)
2006-07-18 17:11 UTC, Daniel Glassey
  Details
pangographite integration module (344.02 KB, application/x-compressed-tar)
2006-11-16 17:47 UTC, Martin Hosken
  Details

Description Daniel Glassey 2004-02-28 17:09:44 UTC
For graphite to work I'd expect to use this algo:

if have a graphite module try it
if font is a graphite font (graphite_engine_covers will check using a
modified fontconfig - bug 105) then use the graphite shaper
otherwise fallback to what pango would otherwise have used.

To achieve this I've added another general script type PANGO_SCRIPT_PREFERRED.

2 diffs will be attached
(1)script.diff - changes to pango-script.* to add PANGO_SCRIPT_PREFERRED. I
arbitrarily picked after PANGO_SCRIPT_COMMON but somewhere else would be fine.
(2)pango.diff - changes to modules.c to support PANGO_SCRIPT_PREFERRED.

Of course, this is not expected to go in for 1.4, just putting it here so I
don't forget.
Comment 1 Daniel Glassey 2004-02-28 17:10:44 UTC
Created attachment 24897 [details] [review]
add PANGO_SCRIPT_PREFERRED
Comment 2 Daniel Glassey 2004-02-28 17:24:57 UTC
Created attachment 24899 [details] [review]
modifications to use PANGO_SCRIPT_PREFERRED
Comment 3 Owen Taylor 2004-02-29 16:16:56 UTC
I'm not entirely sure that that extra script is needed; the way
I'd expect it to work is that the SILGraphite shaper would
simply advertise to cover all scripts exactly, with
PANGO_SCRIPT_COMMON, "*" (as oppposed to the basic shaper
which covers them approximately with PANGO_SCRIPT_COMMON,   "")

Then the Graphite shaper can use the "covers" method to say
whether it wants a particular font or not.

The way that that I set things up for Pango-1.4 is that 
if we have three shapers that handle arabic - 
Arabic (exact) Graphite (exact) and basic (fallback)
and two fonts A, B, the sequence is:

 arabic.covers (A, char)
 graphite.covers (A, char)
 arabic.covers (B, char)
 graphite.covers (B, char)
 basic.covers (A, char)
 basic.covers (B, char)

So, if font A is a graphite font, you get the graphite shaper,
if it is a opentype font, you get the opentype shaper.

There is a pretty big problem with this approach - fontconfig
prunes the list of returned fonts; if font A was a Quickdraw GX
font, then neither the Graphite nor the OpenType shapers would
ever see font B.

The solution to that requires some extra API to let shapers
influence the sorting of the returned lists. I don't know
the exact details. But this shouldn't keep you from experimenting
with a Graphite shaper; just make sure that the fonts you
want to use are specified explicitely or sort on your system
ahead of "chart" fonts that cover the characters but don't
have useful layout tables.
Comment 4 Daniel Glassey 2004-03-01 09:21:13 UTC
>I'm not entirely sure that that extra script is needed; the way
>I'd expect it to work is that the SILGraphite shaper would
>simply advertise to cover all scripts exactly, with
>PANGO_SCRIPT_COMMON, "*" (as oppposed to the basic shaper
>which covers them approximately with PANGO_SCRIPT_COMMON,   "")

I found that that wasn't enough. The basic-fc shaper covers most
scripts exactly (and I'd guess the script specific ones cover the
rest) and pango_map_get_engines and pango_map_get_engine only use an
exact common if an exact script match isn't found.

Another option could be to change the coverage of the basic shaper to
just be PANGO_SCRIPT_COMMON, "". However, it will still be an issue
for the scripts covered by the other shapers.

Or maybe in pango_map_get_engines both the common and entry engines
should be appended (currently it is one or other)-  that sounds like
what you are describing for covers to be checked on multiple shapers.

> arabic.covers (A, char)
> graphite.covers (A, char)

If both the shapers have coverage is it defined which one will be
used? I know that the SIL font folks are putting OT tables into the
fonts as well as graphite ones so they have some functionality on
non-graphite enabled apps.
Comment 5 Owen Taylor 2004-03-01 14:39:28 UTC
If there are particular scripts that Graphite can do a better
job on than 'basic', then they probably shouldn't be marked
"*" for the basic shaper. In generally, only scripts where
I thought that the basic shaper was sufficient for fully
correct rendering got "*". What scripts are you having
issues with?

In terms of the fonts with both sets of tables, I don't have
a good solution there. We could add some sort of priority
system where shapers were sorted by how "good" they claimed
to be, but I don't see how a shaper author knows how
"good" their shaper is compared to other shapers that might
not yet be written...
Comment 6 Daniel Glassey 2004-03-01 20:47:33 UTC
The one I'm having an issue with is Latin. The test font that I'm
using is piglatin. It is a real issue though as stacked diacritics on
a latin font is something that graphite can be used for. Graphite
isn't at the moment better for any particular script (although it
might be at some point if a good script-specific font is made using
it, like Myanmar), it has the potential to add extra features to an
existing script. In particular to add it for a particular language
group that uses a modified script.
Graphite depends on the font rather than the script.

The PANGO_SCRIPT_PREFERRED was my idea for the graphite shaper to say
that its shaper should override any other if the font can handle it.
I'm assuming that the font designer will cover at least the same as
the opentype part of the font in the graphite part.

However, afaict it won't be defined which one will win if another
shaper comes along and wants to be preferred as well. OTOH it is the
same at the moment if more than one shaper wants to be exact for a
script or exact for common.

Alternatively, maybe there could be extra PangoCoverageLevels.

Also, if pango is choosing between different fonts rather than
choosing a shaper for a specific font I'd guess it would be more
likely to want to choose a non-graphite font, or at least not
necessarily choose the graphite one. Are fonts chosen on the basis of
 coverage or is the font chosen by script and then the shaper chosen
by coverage?

The way I'm doing the graphite pango module is to install it to
$(pkglibdir)/pango/$(PANGO_MODULE_VERSION) and then users or sysadmin
can decide to add it or not to the ModulesPath in the pangorc.

Maybe there could be a way to specify relative preferences for shapers
in the pangorc?
Comment 7 Owen Taylor 2004-12-13 20:56:39 UTC
Writeup of what I think the blocking issues here are at:

http://mail.gnome.org/archives/gtk-i18n-list/2004-December/msg00020.html

Moving off 1.8 milestone and marking Priority High as something I'd like
to get to for the next devel cycle.
Comment 8 Daniel Glassey 2005-08-12 15:27:06 UTC
Thanks for your help at GUADEC. I'm pretty sure now that these patches are
unnecessary - it is just important to get the graphite module to the bottom of
the list.

I'm leaving this bug open in case there are changes I'll want to request to get
the cursor tracking right as I want to investigate that further. I'm going to
have another look at the win32 uniscribe module code to see if that helps to get
it working out of the box.

The other thing I'm thinking about is submitting a version of the graphite
module for inclusion in pango. It would load the silgraphite library dynamically
if it is available (like basic-win32 does for usp10.dll). I would expect a
small->negligible performance hit on systems without graphite as
graphite_engine_covers (which would check for has_silgraphite and return false)
would have to be called every time. Does this sound like an acceptable hit? Or
should I just keep the graphite module separate?

Regards,
Daniel
Comment 9 Behdad Esfahbod 2005-10-05 00:24:37 UTC
Any news on this?  Having the Graphite module included would be nice.  We can
work out that little bit about what to do if Graphite is not available later.  I
think what happens is that the pango.modules wont list it and you need to
regenerate it after installing graphite.  No matter which route we take, an
initial patch is needed.
Comment 10 Daniel Glassey 2005-11-30 17:52:34 UTC
I've almost got this ready - a module that is split out that doesn't depend on
graphite, but loads a helper library dynamically. Will attach patch soon.
Comment 11 Daniel Glassey 2005-12-09 18:01:01 UTC
Created attachment 55820 [details] [review]
mods to build system to add graphite module

This part adds graphite module to the build
Comment 12 Daniel Glassey 2005-12-09 18:02:48 UTC
Created attachment 55821 [details]
graphite module

graphite shaping and breaking modules that loads a helper library dynamically
(which uses graphite) if it is available
Comment 13 Behdad Esfahbod 2005-12-09 20:11:00 UTC
Ok, where can I get this libpangographite that the modules dlopens?

And I'm not seeing why you have to duplicate the break.c code.  Would you please
explain a bit what is the code doing?

Thanks.
Comment 14 Daniel Glassey 2005-12-13 09:13:43 UTC
a snapshot from svn of pangographite is available at
http://www.sf.net/projects/silgraphite

The code adds a call to graphite_real_break in the middle of
pango_default_break_for_graphite which allows graphite to do part of breaking -
setting is_cursor_position, is_line_break, is_char_break. The rest of the
algorithm is the same currently.
Comment 15 Daniel Glassey 2006-02-02 23:48:17 UTC
Created attachment 58615 [details] [review]
mods to build system to add graphite module

update patch against current/recent cvs.
Comment 16 Daniel Glassey 2006-02-02 23:51:37 UTC
Created attachment 58616 [details]
graphite module directory

unpack module to modules/

updated break module to just call pango_default_break then do graphite stuff on the result so it is cleaner and easier to maintain.
Comment 17 Daniel Glassey 2006-02-03 00:02:05 UTC
src RPMs of graphite are available at via https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=176071
I'll co-ordinate with Michael to get the latest package made as well including the pangographite support lib but not the pango module.
Comment 18 Behdad Esfahbod 2006-02-05 03:20:49 UTC
Ok, with calling pango_default_break now, I'm a lot happier with your patch.  I will be looking into it sometime soon.  Thanks.
Comment 19 Daniel Glassey 2006-06-30 14:50:19 UTC
Behdad has said that it is ok for the C++ dependency of libpangographite to go into pango so it is ok for libgraphitepango to be merged back into the module. Also that the shaping and breaking modules can be merged together to share the caching. I'll just merge those back in and make sure it works.

Thanks,
Daniel
Comment 20 Daniel Glassey 2006-07-18 17:08:15 UTC
Created attachment 69132 [details] [review]
Build system additions for graphite

changes to configure.in to detect graphite, and Makefile.am to build it
configure.in changes aren't complete (need to decide what to say when graphite isn't found)

You also might prefer to just use AC_PROG_CXX whether or not graphite is there, or to depend on the AC_CHECK_PROGS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], gcc) line 105
Comment 21 Daniel Glassey 2006-07-18 17:11:33 UTC
Created attachment 69133 [details]
graphite module directory

libpangographite has been integrated into this. There are bugs for ligatures which have been introduced by decisions for burmese. We will look into them.
Comment 22 Martin Hosken 2006-11-16 17:47:43 UTC
Created attachment 76712 [details]
pangographite integration module

includes unassigned codepoint support, broken hexboxes
Comment 23 Behdad Esfahbod 2006-11-16 18:33:38 UTC
So, you only try to do a hexbox if the shaping fails completely?  
Comment 24 Martin Hosken 2006-11-21 02:30:43 UTC
hexbox works in HEAD assuming fix in pangographite that gets the glyph box width correct for unknown glyphs.
Comment 25 Nguyen Thai Ngoc Duy 2008-02-16 04:50:32 UTC
any progress?
Comment 26 Behdad Esfahbod 2015-04-30 16:49:39 UTC
This is obsolete.  Enabled graphite2 shaper in harfbuzz instead.