Mindaugas Jaunius | 20 Apr 15:23
Picon

abstract shape PangoLayout/Drop caps/PangoLayout+image from file

Is there a way for PangoLayout to handle abstract shape? The default shape is rectangle is there and easy way to change it or does it require code modifications in pango line breaking algorithm?


Not exactly the same, but similar question. How to implement drop caps (http://en.wikipedia.org/wiki/Initial) in PangoLayout (Pango+Cairo)? I tried using shape renderer, but rendered shape becomes a part of one line only and is not wrapped by other lines if the size is bigger than one line.

Another similar question. How to insert picture from file to PangoLayout(Pango+Cairo)? Is there some kind of special pango markup language tag, special case of using custom shape renderer or is it somehow related to cairo and surface creation? 

Any tips/thoughts/ideas are greatly appreciated.
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list <at> gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
mathog | 12 Mar 23:28
Picon
Favicon

Pango and freetype2 charmap?

Still trying to track down the issue with glyph's not mapping 1:1 with 
Symbol fonts.  Could not reproduce
the problem in a test program (it was not picking up Symbol font at 
all) so have been working on it in Inkscape trunk.
Traced part of the issue to this area of 
inkscape/src/libnrtype/FontInstance.cpp:

     theFace=pango_ft2_font_get_face(pFont); // Deprecated, use 
pango_fc_font_lock_face() instead
     if ( theFace ) {
         FT_Select_Charmap(theFace,ft_encoding_unicode) && 
FT_Select_Charmap(theFace,ft_encoding_symbol);
     }

Put some debug statements like these

     for(i=0x70;i<0xB0;i+=16){
       myfile << std::hex << i ;
       for(j=i;j<i+16;j++){
         myfile << " " << std::hex << FT_Get_Char_Index(theFace,j);
       }
       myfile <<endl;
     }

above and below the FT_Select_Charmap and found

BEFORE
70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
a0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
in font_instance::InitTheFace set charmap FontName SymbolMT status 0
AFTER
70 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 0
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
a0 0 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70

Then commented out the FT_Select_charmap and found:

70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
a0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
in font_instance::InitTheFace commented out - no action
AFTER
70 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
90 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
a0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The glyphs used to actually draw the letters were the same in both of 
these cases, and were NOT the ones listed above
in the FreeType charmap (for characters >7E && <FF).  It seems Pango is 
using its own character map
values to derive glyph ids and ignoring the ones set with Freetype.  
For instance, character value A8 maps
to glyph 109 (decimal) = 0x6D, not the 0 or 6a shown above.  This could 
be seen by putting print statements
in the font_instance::LoadGlyph method.

The SymbolMT font reports (via freetype) that it supports both Apple 
Roman and MS_SYMBOL (not unicode), but changing it to either one of 
those with FT_Select_Charmap made no difference at all in what Inkscape 
displayed.

Where is the charmap pango is using???

(Pango 1.28.3, Freetype 2.4.2)

Thanks,

David Mathog
mathog <at> caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech
mathog | 6 Mar 19:54
Picon
Favicon

Pango issue? Symbol font characters above A0 incorrect for multiple applications

Symbol font characters with hex values >A0 (and <=FF) are generally 
displayed incorrectly in Inkscape and Gimp.
The character shown is not the one corresponding to the hex value.  For 
instance, a5 is either X (times symbol) or
Yen symbol, when it should be the infinity symbol.  Symbol characters 
<A0 display correctly.  This
was seen on Windows XP SP3, with Inkscape 0.48.2, Inkscape trunk (from 
last week) and Gimp 2.6.10.

The two applications give the same wrong characters, so the problem may 
be with Pango, which they both use.

For details and examples for Inkscape see:

https://bugs.launchpad.net/inkscape/+bug/948245

Thank you,

David Mathog
mathog <at> caltech.edu
Manager, Sequence Analysis Facility, Biology Division, Caltech
Mindaugas Jaunius | 1 Mar 14:28
Picon

PangoGlyphString + PangoLayout?

Hi,

To be able to fully control open type font features (liga, smcp, ssup)
I ended up using PangoOTBuffer not just PangoLayout. No the problem I
run into is that the output of PangoOTBuffer is PangoGlyphString. The
only function I found to show it is pango_cairo_show_glyph_string(cr,
font, glyphString), but this function shows the full PangoGlyphString
in one line and does not create a wraping paragraph on PangoLayout. No
is there a way to give my PangoGlyphString from PangoOTBuffer to
PangoLayout?

Below is some code of how I am using PangoOTBuffer now. Mainly I used
code from pango modules class basic-fc.c as an example. Any comments
and critiques on the code are welcomed.

const char foo[] = "ffi ff fl Wa VA";

static const PangoOTFeatureMap gsub_features[] =
{
  {"ccmp", PANGO_OT_ALL_GLYPHS},
  {"locl", PANGO_OT_ALL_GLYPHS},
  {"liga", PANGO_OT_ALL_GLYPHS},
  {"clig", PANGO_OT_ALL_GLYPHS}
};

static const PangoOTFeatureMap gpos_features[] =
{
  {"kern", PANGO_OT_ALL_GLYPHS},
  {"mark", PANGO_OT_ALL_GLYPHS},
  {"mkmk", PANGO_OT_ALL_GLYPHS}
};

cairo_t *cr = cairo_create(surface);
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); // sets the background color to white
cairo_paint(cr);

PangoLayout *layout; // layout for a paragraph of text
layout = pango_cairo_create_layout(cr);

PangoFontDescription *descFont;
pango_layout_set_text(layout, foo, -1);
pango_layout_set_width(layout, width * PANGO_SCALE);
descFont = pango_font_description_from_string("Fedra Serif Pro A Book 20");
pango_layout_set_font_description(layout, descFont);
pango_font_description_free(descFont);

cairo_move_to(cr, 20, 40);
cairo_set_line_width(cr, 1.0); // sets the line width, default is 2.0

cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); // set the colour to black

pango_cairo_update_layout(cr, layout); // update layout

PangoLayoutIter *iter = NULL;
iter = pango_layout_get_iter(layout);

PangoLayoutRun *run = NULL;
run = pango_layout_iter_get_run_readonly(iter);

PangoFont *font = run->item->analysis.font; // get PangoFont of Fedra Serif

PangoFcFont *fc_font = PANGO_FC_FONT(font);

PangoOTBuffer *otBuffer;
otBuffer = pango_ot_buffer_new(fc_font);

glong n_chars = g_utf8_strlen(foo, strlen(foo));
PangoGlyphString *glyphs = pango_glyph_string_new();

const char *p = foo;
int cluster = 0;
int i;
FT_Face face;
PangoOTRulesetDescription desc;
const PangoOTRuleset *ruleset;

face = pango_fc_font_lock_face(fc_font);
if (!face) {
LOGE("Can not lock fc font face");
}

// add all glyphs to otBuffer
for (i = 0; i < n_chars; i++) {
gunichar wc;
PangoGlyph glyph;

wc = g_utf8_get_char(p);

if (g_unichar_type(wc) != G_UNICODE_NON_SPACING_MARK)
	cluster = p - foo1;

if (pango_is_zero_width(wc))
	glyph = PANGO_GLYPH_EMPTY;
else {
	gunichar c = wc;

	if (run->item->analysis.level % 2)
		g_unichar_get_mirror_char(c, &c);

	glyph = pango_fc_font_get_glyph(fc_font, c);
}

if (!glyph)
	glyph = PANGO_GET_UNKNOWN_GLYPH(wc);

pango_ot_buffer_add_glyph(otBuffer, glyph, 0, cluster);

p = g_utf8_next_char(p);
}

// apply open type features
desc.script = run->item->analysis.script;
desc.language = run->item->analysis.language;
desc.n_static_gsub_features = G_N_ELEMENTS(gsub_features);
desc.static_gsub_features = gsub_features;
desc.n_static_gpos_features = G_N_ELEMENTS(gpos_features);
desc.static_gpos_features = gpos_features;
desc.n_other_features = 0;
desc.other_features = NULL;

ruleset = pango_ot_ruleset_get_for_description(pango_ot_info_get(face), &desc);

pango_ot_ruleset_substitute(ruleset, otBuffer);
pango_ot_ruleset_position(ruleset, otBuffer);

// output from otBuffer to PangoGlyphString
pango_ot_buffer_output(otBuffer, glyphs);

pango_cairo_show_glyph_string(cr, font, glyphs);

-mindaugas
Antoine Baudoux | 27 Feb 17:21
Picon

PANGO_RC_FILE environment variable

Hello, 

	I'm trying to run a program called openERP and i got the following error : 

/Users/abaudoux/Documents/ThirdParty/openerp-client-6.0.3/bin/dist/Open
ERP.app/Contents/Resources/lib/python2.6/site-packages.zip/modules/gui/main.py:694:
PangoWarning: No modules found:
No builtin or dynamically loaded modules were found.
PangoFc will not work correctly.
This probably means there was an error in the creation of:
  '/opt/local/etc/pango/pango.modules'
You should create this file by running:
  pango-querymodules > '/opt/local/etc/pango/pango.modules'

But I have set the PANGO_RC_FILE to the path to a file  containing the following lines : 

[Pango]
ModulesPath="/Users/abaudoux/Documents/ThirdParty/openerp-client-6.0.3/bin/dist/Open ERP.app/Contents/Resources/"
ModuleFiles="/Users/abaudoux/Documents/ThirdParty/openerp-client-6.0.3/bin/dist/Open ERP.app/Contents/Resources/pango.modules"

So It seems the value of PANGO_RC_FILE is not taken into account. Am I missing something here?

Thanks for your help,

Antoine
Jeremy Moles | 22 Feb 23:00
Picon
Favicon

Gravity Support / pangowin32

Hello everyone. I am interested in getting gravity support to work in
Pango on Windows using the Win32 backend (I haven't tested this using
hte Fc/FT backend on Windows).

Does anyone have any experience with this? Does anyone know where I
would need to start hacking to add support? I don't mind doing the work,
but I truly have no idea where to even start.

In pangowin32-fontmap.c there is a routine:

	pango_win32_font_map_load_font

...and this routine will return a valid PangoFont* UNLESS you have
gravity set. For whatever reason, the current implementation doesn't
understand how to handle the "Rotated-*" style that is added inside the
description when gravity is set.

How does gravity actually work in Pango internally? Do the font files on
disk have to provide some extra hints?

Any help would be appreciated, and thanks beforehand...
Ferdinand Ramirez | 14 Feb 03:59
Picon
Favicon

Rendering a custom glyph using pango

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?

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.

Thanks,
-Ferdinand
Picon
Favicon

How to install pangocairo

I am installing some software that depends upon the pango – and pangocairo packages.

 

I downloaded pango version 1.29.3 and performed the ./configure – make - make install sequence with no apparent errors

 

(Note: I had previously install cairo version 1.10.2, also with no apparent errors.)

 

However, even though it appears that the  pango make built the pangocairo module, the make install step did not install it.

 

How can I force the install of the pangocairo module?

 

Thanks.

 

Jim Tilton

Dr. James C. Tilton                                                Voice:   301-286-9510

NASA Goddard Space Flight Center                   FAX:     301-286-1776

Mail Code 606.3                                                    E-Mail:  James.C.Tilton <at> nasa.gov

(Computational & Information Sciences and Technology Office)

Greenbelt, MD 20771      

URLs:      http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/

 

_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list <at> gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Steve White | 28 Jan 14:51

'rkrf' feature in pango

Hi!

I was beating myself up for two days trying to follow the MS
Typography pages about setting up Indic lookup tables:
  http://www.microsoft.com/typography/otfntdev/devanot/features.aspx
In particular, I could't get the Rakaar feature 'rkrf' working at all,
although those pages emphasize that this is the correct way to handle
Hindi.

Finally I checked out the pango source: I see no mention of 'rkrf' anywhere.
Another Indic feature missing from Pango is: 'cjct'.

What's the story on this?
Is this policy, or an oversight, or a to-do?
robertk54 | 27 Jan 14:49
Picon
Favicon

gtk_init(NULL, NULL) segfault

I am using a GDK pixbuf for rendering images onto a Cairo surface.  I have a Windows application used for prototyping this.  It initializes GTK by calling gtk_init(NULL, NULL).  This works fine and the application renders images well.  The target for this application is Linux and the same call results in a warning ((<unknown>:32758): Gdk-WARNING **: cannot open display:) followed by a segfault.  Is there something else I need to do in order to satisfy the gtk_init API on Linux?

Thanks!
Bob
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list <at> gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list
Ulrich von Zadow | 25 Jan 15:50
Favicon

Changes in line spacing

Hi,

Pango 2.24 to Pango 2.29 (Ubuntu 11.10 to 12.04), the line spacing of pango layouts has changed (Tested
using Bitstream Vera Sans). Is this a known effect? Is there a way to get the old behaviour back?

Cheers,

  Uli

--
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: coder <at> c-base.org
Skype: uzadow

Gmane