On Fri, Jan 6, 2012 at 7:33 PM, Nicolas Rougier <span dir="ltr"><<a href="mailto:Nicolas.Rougier@inria.fr" target="_blank">Nicolas.Rougier@inria.fr</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div><br></div><div>Thanks for the explanation but now I'm a bit lost...</div><div>I thought that harfbuzz could work alone for shaping but from what you suggest (I need to try), I would need either glib or ICU, is that right ?</div>
</div></blockquote><div><br></div><div>You need not depend on either glib or ICU if you implement what harfbuzz requires (that is <span style>hb_unicode_funcs_t in this case). Please take a look at hb-glib.cc or hb-icu.cc if you want to know what you need to implement.</span></div>
<div><span style><br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">
<div>But if I have to depend on ICU, I could as well use it directly for shaping and layout, no ?</div><span><font color="#888888"><div><br></div></font></span></div></blockquote><div><br></div><div>I'm not sure, but I think ICU doesn't handle text shaping itself.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span><font color="#888888"><div></div><div><br></div><div>Nicolas </div>
</font></span><div><div>
<div><br></div><br><div><div>On Jan 6, 2012, at 10:46 , Kenichi Ishibashi wrote:</div><br><blockquote type="cite">I took a look at your code and noticed that you don't call hb_buffer_set_unicode_funcs(). Since both HAVE_GLIB and HAVE_ICU are not defined, _hb_unicode_funcs_nil is used as default. It won't work for many cases(including ligatures). You need to implement your custom hb_unicode_funcs_t or use existing functions(hb_{glib,icu}_unicode_funcs).<div>
<br></div><div>I think using ICU is a handy way if you can depend on ICU. hb-icu.cc contains two 'gint' variables, but you can just remove 'g' from them (Someone already sent a patch, IIRC).</div><div><br>
</div><div>Thanks,</div><div><br><div class="gmail_quote">On Fri, Jan 6, 2012 at 5:09 PM, Nicolas Rougier <span dir="ltr"><<a href="mailto:Nicolas.Rougier@inria.fr" target="_blank">Nicolas.Rougier@inria.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>Thanks, this was certainly an error but it did not fix the problem.</div><span><font color="#888888"><div><br></div><div>Nicolas</div></font></span><div>
<div><div><br></div><br><div><div>On Jan 6, 2012, at 9:00 , Kenichi Ishibashi wrote:</div><br><blockquote type="cite">You may want to define "HAVE_OT" if you use your custom makefile (see <a href="http://configure.ac/" target="_blank">configure.ac</a>).<br>
<br><div class="gmail_quote">On Fri, Jan 6, 2012 at 4:40 PM, Nicolas Rougier <span dir="ltr"><<a href="mailto:Nicolas.Rougier@inria.fr" target="_blank">Nicolas.Rougier@inria.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Thanks for the quick answer. I will try to investigate a bit further to see if there are any errors.<br>
If anyone on the list can test the code and report results, that might be helpful as well.<br>
<br>
I'm attaching the Makefile I used to compile (removed all glib stuff, maybe this where the error is):<br>
<br>
Nicolas<br>
<br>
Makefile<br>
======<br>
<br>
PLATFORM = $(shell uname)<br>
CC = g++<br>
CFLAGS = -Wall `freetype-config --cflags`<br>
LIBS = `freetype-config --libs`<br>
<br>
SOURCES = main.cc \<br>
hb-blob.cc hb-buffer.cc hb-common.cc hb-fallback-shape.cc hb-font.cc \<br>
hb-ft.cc hb-ot-layout.cc hb-ot-map.cc hb-ot-shape-complex-arabic.cc \<br>
hb-ot-shape-complex-indic.cc hb-ot-shape-complex-misc.cc hb-shape.cc \<br>
hb-ot-shape-normalize.cc hb-ot-shape.cc hb-ot-tag.cc hb-unicode.cc<br>
<br>
HEADERS = \<br>
hb-buffer-private.hh hb-fallback-shape-private.hh hb-font-private.hh \<br>
hb-ot-shape-complex-arabic-table.hh hb-ot-shape-complex-indic-table.hh \<br>
hb-ot-shape-complex-private.hh hb-mutex-private.hh hb-object-private.hh \<br>
hb-open-file-private.hh hb-open-type-private.hh hb-ot-head-table.hh \<br>
hb-ot-hhea-table.hh hb-ot-hmtx-table.hh hb-ot-layout-common-private.hh \<br>
hb-ot-layout-gpos-table.hh hb-ot-layout-gsub-table.hh hb-unicode.h \<br>
hb-ot-layout-gsubgpos-private.hh hb-ot-layout-private.hh hb-shape.h \<br>
hb-ot-map-private.hh hb-ot-maxp-table.hh hb-ot-name-table.hh hb-blob.h \<br>
hb-private.hh hb-unicode-private.hh hb.h hb-buffer.h hb-version.h hb-ot.h \<br>
hb-common.h hb-font.h hb-ft.h hb-ot-layout.h hb-ot-shape.h hb-ot-tag.h<br>
<br>
OBJECTS := $(SOURCES:.cc=.o)<br>
<br>
all: main<br>
<br>
main: $(OBJECTS)<br>
$(CC) $(OBJECTS) $(LIBS) -o $@<br>
<br>
%.o : %.cc<br>
@echo "$@..."<br>
@$(CC) -c $(CFLAGS) $< -o $@<br>
<br>
clean:<br>
@-rm -f glut-main<br>
@-rm -f $(OBJECTS)<br>
<br>
distclean: clean<br>
@-rm -f *~<br>
<div><div><br>
<br>
<br>
On Jan 5, 2012, at 23:07 , Behdad Esfahbod wrote:<br>
<br>
> On 01/05/2012 04:44 PM, Nicolas Rougier wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I've been trying to simplify the hb-shape.c example from the util directory in order to remove any glib dependencies and come up with source below ( ~50 lines) but it does not seem to work (no ligature for fi):<br>
>><br>
>> $ hb-shape DejaVuSans.ttf "fi"<br>
>> <fi=0+1290><br>
>><br>
>> $ main DejaVuSans.ttf "fi"<br>
>> <f=0+721|i=2+569><br>
>><br>
>><br>
>> Did I do something wrong ?<br>
><br>
> The code looks fine. I'm out of ideas. Can you recompile harfbuzz with glib<br>
> and test the same code?<br>
><br>
> behdad<br>
><br>
>><br>
>> Nicolas<br>
>><br>
>><br>
>> main.cc<br>
>> ======<br>
>><br>
>> #include <stdio.h><br>
>> #include <ft2build.h><br>
>> #include FT_FREETYPE_H<br>
>> #include "hb-ft.h"<br>
>><br>
>> int main( int argc, char **argv )<br>
>> {<br>
>> const char *text = "fi";<br>
>> char glyph_name[30];<br>
>> size_t i;<br>
>><br>
>> FT_Library library;<br>
>> FT_Face face;<br>
>> FT_Init_FreeType( &library );<br>
>> FT_New_Face( library, "./DejaVuSans.ttf", 0, &face );<br>
>> FT_Set_Char_Size( face, (int)(32*64), 0, 72, 72 );<br>
>><br>
>> hb_font_t * font = hb_ft_font_create( face, 0 );<br>
>> hb_ft_font_set_funcs( font );<br>
>><br>
>> hb_buffer_t * buffer = hb_buffer_create( );<br>
>> hb_buffer_set_direction( buffer, HB_DIRECTION_LTR );<br>
>> hb_buffer_add_utf8( buffer, text, strlen(text), 0, strlen(text) );<br>
>> hb_shape( font, buffer, NULL, 0 );<br>
>> unsigned int num_glyphs = hb_buffer_get_length (buffer);<br>
>> hb_glyph_info_t* glyphs = hb_buffer_get_glyph_infos( buffer, 0 );<br>
>> hb_glyph_position_t *pos = hb_buffer_get_glyph_positions( buffer, 0 );<br>
>> hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);<br>
>><br>
>> for( i=0; i<num_glyphs; ++i )<br>
>> {<br>
>> if( i ) printf( "|" );<br>
>> else printf( "<" );<br>
>> if (!FT_Get_Glyph_Name( face, glyphs[i].codepoint, glyph_name, sizeof (glyph_name) ))<br>
>> printf( "%s", glyph_name );<br>
>> else<br>
>> printf( "%u", info->codepoint );<br>
>> printf( "=%u", info->cluster );<br>
>> if (pos->x_offset || pos->y_offset) {<br>
>> printf("@");<br>
>> if (pos->x_offset) printf ("%d", pos->x_offset);<br>
>> if (pos->y_offset) printf (",%d", pos->y_offset);<br>
>> }<br>
>> if (pos->x_advance || pos->y_advance) {<br>
>> printf ("+");<br>
>> if (pos->x_advance) printf ("%d", pos->x_advance);<br>
>> if (pos->y_advance) printf (",%d", pos->y_advance);<br>
>> }<br>
>> ++pos; ++info;<br>
>> }<br>
>> printf( ">\n" );<br>
>><br>
>> hb_font_destroy(font);<br>
>> FT_Done_Face( face );<br>
>> FT_Done_FreeType( library );<br>
>> }<br>
>><br>
>><br>
>> _______________________________________________<br>
>> HarfBuzz mailing list<br>
>> <a href="mailto:HarfBuzz@lists.freedesktop.org" target="_blank">HarfBuzz@lists.freedesktop.org</a><br>
>> <a href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz" target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
>><br>
<br>
_______________________________________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org" target="_blank">HarfBuzz@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/harfbuzz" target="_blank">http://lists.freedesktop.org/mailman/listinfo/harfbuzz</a><br>
</div></div></blockquote></div><br>
</blockquote></div><br></div></div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Kenichi Ishibashi<div><a href="mailto:bashi@google.com" target="_blank">bashi@google.com</a></div><br>