Re: [HarfBuzz] Line break properties in UCDN

2012-11-09 Thread Tom Hacohen
On 09/11/12 08:19, Lóránt Pintér wrote:
 Hi,
 
 Would it be possible to include data from LineBreaks.txt in the ucdn
 project? Maybe a conditional during build to enable this? Or am I
 missing something, and it's already included? (makeunicodedata.py
 mentions it, but I don't see it anywhere in the API.)

There's actually an whole algorithm for handling linebreak positions,
it's not just a matter of using the data. Please consider using
liblinebreak that handles both the line and word breaking algorithms. If
you are referring to what Behdad was talking about the other day about
the issue with firefox/gtk+ (if I remember correctly), you can't really
do that. The line breaking data only lets you know about break
opportunities (or musts), but in order to really know where to breaks
at, you'd actually need to know the rendering constraints of your
environment, i.e when you actually want to break. I don't remember
exactly what the firefox issue was, but doing linebreaking goes more
into the scope of pango than harfbuzz.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz: Branch 'master'

2012-09-02 Thread Tom Hacohen

Thanks for the commit, have been waiting for this one.

As for the first issue: there's only so much you can do to workaround 
broken fonts.


--
Tom.

On 02/09/12 03:40, Behdad Esfahbod wrote:

  src/hb-ot-shape.cc |   32 
  1 file changed, 32 insertions(+)

New commits:
commit 6912e476dd92639c3ddf07ca51c8d4a262c8b3a5
Author: Behdad Esfahbod beh...@behdad.org
Date:   Sat Sep 1 20:38:45 2012 -0400

 [OT] Insert dotted-circle for run-initial marks

 Unfortunately if the font has GPOS and 'mark' feature does
 not position mark on dotted-circle, our inserted dotted-circle
 will not get the mark repositioned to itself.  Uniscribe cheats
 here.

 If there is no GPOS however, the fallback positioning kicks in
 and sorts this out.

 I'm not willing to address the first case.

diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 26b21ce..a19c8b2 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -235,6 +235,37 @@ hb_set_unicode_props (hb_buffer_t *buffer)
  }

  static void
+hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
+{
+  /* TODO One day, when we keep _before_ text for the buffer, take
+   * that into consideration.  For now, insert dotted-circle if the
+   * very first character is a non-spacing mark. */
+  if (_hb_glyph_info_get_general_category (buffer-info[0]) !=
+  HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+return;
+
+  hb_codepoint_t dottedcircle_glyph;
+  if (!font-get_glyph (0x25CC, 0, dottedcircle_glyph))
+return;
+
+  hb_glyph_info_t dottedcircle;
+  dottedcircle.codepoint = 0x25CC;
+  _hb_glyph_info_set_unicode_props (dottedcircle, buffer-unicode);
+
+  buffer-clear_output ();
+
+  buffer-idx = 0;
+  hb_glyph_info_t info = dottedcircle;
+  info.cluster = buffer-cur().cluster;
+  info.mask = buffer-cur().mask;
+  buffer-output_info (info);
+  while (buffer-idx  buffer-len)
+buffer-next_glyph ();
+
+  buffer-swap_buffers ();
+}
+
+static void
  hb_form_clusters (hb_buffer_t *buffer)
  {
unsigned int count = buffer-len;
@@ -526,6 +557,7 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
c-buffer-clear_output ();

hb_set_unicode_props (c-buffer);
+  hb_insert_dotted_circle (c-buffer, c-font);
hb_form_clusters (c-buffer);

hb_ensure_native_direction (c-buffer);
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz



___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Standalone Unicode support library

2012-08-20 Thread Tom Hacohen

Hey Grigori,

Thanks a lot for this wonderful lib. I haven't checked the code nor have 
I tried compiling/using it, but just the concept is very much needed. 
Could you please consider adding CMake (or any other build system) 
support so it'll be easier to just build a lib out of it?


Thanks a lot,
Tom.

On 19/08/12 16:24, Grigori Goronzy wrote:

Hi everyone,

I have put together a simple standalone Unicode support library that
provides just the functionality HarfBuzz needs. This should be useful
for the people that want to use HarfBuzz on non-Unix platforms. It's
much, much smaller than ICU or glib, less than 200 KB binary size on
x86_64, and is implemented in plain C89 with no extra dependencies.

The library is called UCDN (which stands for Unicode Database and
Normalization) and is available from Github:

https://github.com/grigorig/ucdn

Hangul Jamo (de)composition is not yet implemented, but apart from that
I haven't found any obvious differences to glib's Unicode functions.

The included HarfBuzz connector hb-ucdn.h makes it really easy to use
with HarfBuzz: just create a hb_unicode_funcs_t structure with
hb_ucdn_make_unicode_funcs and pass that to a hb_buffer_t with
hb_buffer_set_unicode_funcs.

Best regards
Grigori
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz



___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Harfbuzz does not compile (errors)

2012-06-03 Thread Tom Hacohen

Thanks.

gcc 4.7.0

--
Tom.

On 03/06/12 22:55, Behdad Esfahbod wrote:

Fixed.  Interesting.  What compiler was this?

On 06/03/2012 06:45 AM, Tom Hacohen wrote:

Dear,

The following commit breaks compilation:

commit 0558d55bac7fb9279aac859b465e7c0e3ad97492
Author: Behdad Esfahbodbeh...@behdad.org
Date:   Mon May 28 10:46:47 2012 -0400

 Remove hb_atomic_int_set/get()

 We never use them in fact...

 I'm just adjusting these as I better understand the requirements of
 the code and the guarantees of each operation.


Errors:
In file included from hb-buffer-private.hh:35:0,
  from hb-ot-map-private.hh:32,
  from hb-ot-shape-private.hh:32,
  from hb-ot-shape.cc:29:
hb-object-private.hh: In constructor
'_hb_object_header_t::_hb_object_header_t()':
hb-object-private.hh:97:8: error: uninitialized const member in 'struct
hb_reference_count_t'
hb-object-private.hh:51:25: note: 'hb_reference_count_t::ref_count' should be
initialized
In file included from hb-ot-shape.cc:33:0:
hb-set-private.hh: In constructor '_hb_set_t::_hb_set_t()':
hb-set-private.hh:37:8: note: synthesized method
'_hb_object_header_t::_hb_object_header_t()' first required here
hb-ot-shape.cc: In function 'void hb_ot_shape_glyphs_closure(hb_font_t*,
hb_buffer_t*, const hb_feature_t*, unsigned int, hb_set_t*)':
hb-ot-shape.cc:521:12: note: synthesized method '_hb_set_t::_hb_set_t()' first
required here


Thanks,
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz





___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 86 commits

2012-05-13 Thread Tom Hacohen
Been trying to catch you on IRC to thank you personally, but we seem to 
be completely out of sync lately.


Thanks a lot! I'll start testing it soon. :)

--
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Possible bug with shaping

2012-04-12 Thread Tom Hacohen

On 12/04/12 16:41, Behdad Esfahbod wrote:

On 01/23/2012 02:52 AM, Tom Hacohen wrote:

On 23/01/12 02:12, Behdad Esfahbod wrote:

Quite possible.  The Indic shaper is far from perfect.  I'm working on getting
the test suite going so I can drive the number of failures way down.  Getting
there, slowly but surely.


Ahh, damn, I really need it ready. :) Any eta?


I just fixed the particular bug you were facing.



Thanks! :)

It helps if you bring up issues, I can then fix them.  As for eta, second week
of May Jonathan and I are going to try to fix as many Indic bugs as we can.



Thanks for the info.

--
Tom.


___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Possible bug with shaping

2012-01-30 Thread Tom Hacohen

On 30/01/12 11:53, Shriramana Sharma wrote:

That's all understood. Just thought you might be interested in what is
written with the script you are working with.



I was interested, and I do appreciate the translation. I actually 
replied to the wrong person, I meant to reply to the previous replier. 
:) I was just explaining why it doesn't matter and should not be removed.


Regarding your translation: I wonder what made my colleagues try this 
word. :)


Thanks.

--
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Possible bug with shaping

2012-01-29 Thread Tom Hacohen

Sure.

Attached.

--
Tom.

On 29/01/12 15:45, Behdad Esfahbod wrote:

Thanks Tom.  Can you please send me a straight patch?  Just add them to:

test/shaping/texts/in-tree/shaper-indic/indic/script-devanagari/misc/misc.txt

behdad

On 01/29/2012 04:00 AM, Tom Hacohen wrote:

On 23/01/12 02:12, Behdad Esfahbod wrote:

Thanks.  I added the sequence to the test suite for now.


Dear Behdad,

Here is another set of words that don't display correctly, so you'll be able
to add to the test suite:

आरम्भित
अ (U+0905)
आ (U+0906)
र (U+0930)
म (U+092E)
् (U+094D)
भ (U+092D)
ि (U+093F)
त (U+0924)

कच्चि
क (U+0915)
च (U+091A)
् (U+094D)
च (U+091A)
ि (U+093F)

सन्धि
स (U+0938)
न (U+0928)
् (U+094D)
ध (U+0927)
ि (U+093F)

दक्षिण
द (U+0926)
क (U+0915)
् (U+094D)
ष (U+0937)
ि (U+093F)
ण (U+0923)

पत्नि
प (U+092A)
त (U+0924)
् (U+094D)
न (U+0928)
ि (U+093F)

उन्निस
उ (U+0909)
न (U+0928)
् (U+094D)
न (U+0928)
ि (U+093F)
स (U+0938)

पश्चयाताप
प (U+092A)
श (U+0936)
् (U+094D)
च (U+091A)
य (U+092F)
ा (U+093E)
त (U+0924)
ा (U+093E)
प (U+092A)

चट्टान
च (U+091A)
ट (U+091F)
् (U+094D)
ट (U+091F)
ा (U+093E)
न (U+0928)

अट्ठारह
अ (U+0905)
ट (U+091F)
् (U+094D)
ठ (U+0920)
ा (U+093E)
र (U+0930)
ह (U+0939)

अट्ठाईस
अ (U+0905)
ट (U+091F)
् (U+094D)
ठ (U+0920)
ा (U+093E)
ई (U+0908)
स (U+0938)

And also, the following vowels, when appended to ◌ (dotted circle) don't show
correctly:
U+09CBো
U+09CCৌ
U+0D4Aൊ
U+0D4Bോ
U+0D4Cൌ
U+0BCAொ
U+0BCBோ
U+0BCCௌ

I hope this helps.

Thanks a lot,
Tom.





From 740462ce75c5a300cdfcb7b9a3a19f5458c9358d Mon Sep 17 00:00:00 2001
From: Tom 'TAsn' Hacohen tom.haco...@partner.samsung.com
Date: Sun, 29 Jan 2012 16:10:47 +0200
Subject: [PATCH] Added more indic test strings to the tests.

Signed-off-by: Tom 'TAsn' Hacohen tom.haco...@partner.samsung.com
---
 .../indic/script-devanagari/misc/misc.txt  |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-devanagari/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-devanagari/misc/misc.txt
index 0ab04d6..0d70652 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-devanagari/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-devanagari/misc/misc.txt
@@ -25,3 +25,21 @@
 西뺖쪓西�
 西뺖쪓�€뚟ㅇ
 西뺖쪓�€띭ㅇ
+西녱ㅀ西�誓띭ㄽ西욈ㄴ
+西뺖쩀誓띭쩀西�
+西멘ㄸ誓띭ㄷ西�
+西╆쨻誓띭ㅇ西욈ㄳ
+西むㄴ誓띭ㄸ西�
+西됢ㄸ誓띭ㄸ西욈ㅈ
+西むㅆ誓띭쩀西�西약ㄴ西약ㄺ
+西싟쩅誓띭쩅西약ㄸ
+西끶쩅誓띭쩆西약ㅀ西�
+西끶쩅誓띭쩆西약쨮西�
+�뿄鋤�
+�뿄鋤�
+�뿄碩�
+�뿄碩�
+�뿄碩�
+�뿄晳�
+�뿄晳�
+�뿄晳�
-- 
1.7.8.4

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Possible bug with shaping

2012-01-19 Thread Tom Hacohen

Dear,

A colleague of mine found a possible bug with Hindi.

The string द्दि (u0926 + u094d + u0926 + u093f) displays correctly in 
GTK+ but not with hb-view (I tried with the Gargi-1.2b font).


Please let me know if you need any more information.

Thanks,
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Level of support for HB in existing toolkits

2011-08-21 Thread Tom Hacohen

On 19/08/11 16:20, Shriramana Sharma wrote:

Hello -- is there any assessment of the level of support for HB
(possibly split up into support for HB-legacy or HB-ng) in existing
major toolkits/libraries?

I'm looking for something like:

| HB-legacy | HB-ng
--+---+--
GTK/Pango 2: | |
Qt 4 | |
ICU | |
Webkit | |

and such...




EFL (enlightenment.org) uses HB-ng. As for level of support: you don't 
have complete access to HB-ng from the upper layers (i.e OT features or 
even setting the language).


--
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2011-08-02 Thread Tom Hacohen

On 02/08/11 17:17, Shriramana Sharma wrote:

I'm trying to update my local copy of HB since Behdad is doing more
commits, but doing git fetch is still silent and my repo (according to
git log) is still standing at commit
5e72071062c015237b79fbd0521341a63166a204

Please tell me what I am doing wrong...


git fetch only fetches the commits to the local cache, it doesn't merge 
them into your local branch.


run git pull --rebase

It fetches and merges (and tries to rebase any local changes on top of 
the branch) everything from upstream to the local branch.


--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2011-08-02 Thread Tom Hacohen

On 02/08/11 17:25, Shriramana Sharma wrote:

BTW how about that question which I asked on the other thread -- how to
build HB based on my latest git-pulled tree without mucking up the
source-tree with compiled files?


It's git, you shouldn't have to care about such nonsense. If you ever 
want to go back to a clean tree, you can just git clean -dfx which 
will remove all untracked files recursively (use with care).


Other than that, why would you care?

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 3 commits

2011-08-01 Thread Tom Hacohen

On 31/07/11 20:50, Behdad Esfahbod wrote:

  src/hb-ot-shape-complex-indic.cc |   61 
+--
  1 file changed, 53 insertions(+), 8 deletions(-)

New commits:
commit 9da0487cd452d780673e24329ce03e174a4ef83b
Author: Behdad Esfahbodbeh...@behdad.org
Date:   Sun Jul 31 13:46:44 2011 -0400

 [Indic] Support ZWJ/ZWNJ

 Brings test-shape-complex failures down from 52 to 10!

 I hereby declare harfbuzz-ng supporting Indic!


Yay, grats. What about an announcement? :P I know many have been waiting 
for this.


Thanks a lot for your work,
Tom.

(forgot to send to list).
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] [PATCH] Adding a configure flag to disable building of tests

2011-07-21 Thread Tom Hacohen

On 20/07/11 23:44, Behdad Esfahbod wrote:

I actually fixed that last week, but seems like I had not pushed it out.  Done
now.

I'd rather keep the configure magic to a minimum for now until I decide
exactly what kind of configure API I want to provide.


Dear Behdad,

test-unicode.c: At top level:
test-unicode.c:237: error: ‘HB_UNICODE_GENERAL_CATEGORY_COMBINING_MARK’ 
undeclared here (not in a function)


And again, can't compile because of the tests (which I don't care about).

--
Tom.
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] [PATCH] Adding a configure flag to disable building of tests

2011-07-20 Thread Tom Hacohen

Dear all,

Currently, the testing code depends on g_test_fail which was only 
introduced in glib 2.30. This means that the harfbuzz build now depends 
on glib 2.30 was is not necessary for regular harfbuzz.


One solution, would be checking the existence of this function or 
checking that the glib version is new enough, and only then build the 
testing code. I opted for the more specific solution - letting people 
disable building the tests.


Many people don't care about the tests anyway, so allowing to disable 
them is probably a good idea anyway.


Currently, just to keep behaviour, I made test building on by default 
(tbh, I think it should be off by default) and people can disable them 
using --disable-tests.


Attached is a patch to implement the described behaviour.

--
Tom.
From 8f286ff042b57e0fa37b1c0e42f6ff2a70374258 Mon Sep 17 00:00:00 2001
From: Tom 'TAsn' Hacohen tom.haco...@partner.samsung.com
Date: Wed, 20 Jul 2011 12:34:40 +0300
Subject: [PATCH] Added --disable-tests for disabling building of tests.

---
 Makefile.am  |6 +-
 configure.ac |   16 
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index bb68ede..cc60edc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,11 @@
 
 NULL =
 
-SUBDIRS = src test
+SUBDIRS = src
+
+if WANT_TESTS
+SUBDIRS += test
+endif
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = harfbuzz.pc
diff --git a/configure.ac b/configure.ac
index d2a2331..a4538b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -133,6 +133,22 @@ AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
 
 dnl ===
 
+want_tests=yes
+AC_ARG_ENABLE([tests],
+   AC_HELP_STRING([--disable-tests],
+  [disable building tests. @:@default=enabled@:@]),
+   [
+if test x${enableval} = xyes ; then
+   want_tests=yes
+else
+   want_tests=no
+fi
+   ])
+
+AM_CONDITIONAL(WANT_TESTS, test x${want_tests} = xyes)
+
+dnl ===
+
 AC_CONFIG_FILES([
 Makefile
 harfbuzz.pc
-- 
1.7.0.4

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Unicode vs glyphs

2011-06-14 Thread Tom Hacohen
On Tue, 2011-06-14 at 16:37 +0200, Eduardo Castiñeyra wrote:
 That's a good question. We have a render engine that expects the string 
 to be passed in Unicode format, as all the drawing methods are based on 
 Unicode indices. Changing it into a glyph based engine is not cheap and 
 I have to provide a good reason to do so.
I.c, that sucks :P
 
 We never needed to work with glyph indices before, for instance, we were 
 using FriBidi to convert from logic to visual, and it returned Unicode 
 indices (fribidi didn't even need to know the font).
That's because the BiDi algorithm has nothing to do with the font.
 But now, with HB or ICU we have to deal with them. The only explanation is 
 that those glyphs 
 which have no Unicode index are not present in arabic nor other BiDi 
 scripts, and maybe that's why we can take FriBidi returned glyphs are 
 the same numbers than the Unicode indices.
Glyph indexes are completely different than unicode indexes, one is the
representation of the char in unicode and the other is index in the
specific font file to a glyph.

Fribidi does *not* work with glyphs, but only with unicode codepoints.

As for indexes that don't have a matching code point first and
foremost, this appears in most (all) of the Indic scripts, special
ligatures, character variants and etc. You really can't avoid them in a
complete implementation.
 
  I mostly use the Microsoft pages, but if you can find something else,
  please let me know.
 
 Could you give me those MS links?
opentype stuff: http://www.microsoft.com/typography/otspec/
typography in general: http://www.microsoft.com/typography/default.mspx

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] [PATCH] Fixed inifinite loop in gpos code

2011-05-30 Thread Tom Hacohen
Dear,

Commit 7403e055cd1463f38215ad9faedd61c3e1b66ac5 introduced an infinite
loop, this patch fixes it.

--
Tom.
From e27c819388aa7e02b6bf26a101ac55aeef1bbd0e Mon Sep 17 00:00:00 2001
From: Tom 'TAsn' Hacohen tom.haco...@partner.samsung.com
Date: Mon, 30 May 2011 10:33:01 +0300
Subject: [PATCH] Fixed inifinite loop introduced in 7403e055cd1463f38215ad9faedd61c3e1b66ac5

k is the index, not j.
---
 src/hb-ot-layout-gpos-private.hh |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index d51a2b0..59750ab 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -1553,12 +1553,12 @@ fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t di
   pos[i].y_offset += pos[j].y_offset;
 
   if (HB_DIRECTION_IS_FORWARD (direction))
-for (unsigned int k = j; k  i; j++) {
+for (unsigned int k = j; k  i; k++) {
   pos[i].x_offset -= pos[k].x_advance;
   pos[i].y_offset -= pos[k].y_advance;
 }
   else
-for (unsigned int k = j + 1; k  i + 1; j++) {
+for (unsigned int k = j + 1; k  i + 1; k++) {
   pos[i].x_offset += pos[k].x_advance;
   pos[i].y_offset += pos[k].y_advance;
 }
-- 
1.7.0.4

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Inheriting/copying font functions

2011-05-16 Thread Tom Hacohen
On Sun, 2011-05-15 at 16:43 -0400, Behdad Esfahbod wrote:
 Looks right.

Thank you very much.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Inheriting/copying font functions

2011-05-15 Thread Tom Hacohen
On Thu, 2011-05-12 at 10:17 +0300, Tom Hacohen wrote:
 My code now looks like:
 
hb_ft_font = hb_ft_font_create(ft_face, NULL);
hb_font = hb_font_create_sub_font(hb_ft_font);
 
hb_font_set_funcs(hb_font, my_font_funcs_get(), my_data,NULL);
 
hb_shape(hb_font, buffer, NULL, 0);
 
hb_font_destroy(hb_font);
hb_font_destroy(hb_ft_font);
 
 my_font_funcs_get() return my font functions that have either nil or my
 implementation alternatives.


Oops, forgot to ask, is this correct?

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Possible memory leaks in latest revision

2011-05-12 Thread Tom Hacohen
On Wed, 2011-05-11 at 14:38 -0400, Behdad Esfahbod wrote:
 On 05/11/11 12:37, Tom Hacohen wrote:
  Since it used to work and the code looks correct, I think it's a memory
  leak, but it's possibly my misuse of the API. Please let me know.
 
 All fixed and in master now.

Thanks a lot.

Regarding your previous email: Bugs happen, especially in
super-cutting-edge software (i.e latest git revision). Anyhow, happy to
see it's fixed (haven't tested it yet) thanks a lot.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Inheriting/copying font functions

2011-05-12 Thread Tom Hacohen
On Wed, 2011-05-11 at 10:09 -0400, Behdad Esfahbod wrote:
 You start by subclassing the font:
 
   font = hb_font_create_sub_font (parent);
 
 And set your own font-funcs on it:
 
   hb_font_set_funcs (font, ffuncs, your_user_data, your_destroy);
 
 Now you only have to override any functions you need, and in your function if
 you need to chain up, you do, eg.
 
 {
   if (not in cache...) {
 hb_font_get_contour_point (hb_font_get_parent (font),
glyph, point_index, x, y);
 add to cache...
   } else {
 lookup from cache...
   }
 }

My code now looks like:

   hb_ft_font = hb_ft_font_create(ft_face, NULL);
   hb_font = hb_font_create_sub_font(hb_ft_font);

   hb_font_set_funcs(hb_font, my_font_funcs_get(), my_data,NULL);

   hb_shape(hb_font, buffer, NULL, 0);

   hb_font_destroy(hb_font);
   hb_font_destroy(hb_ft_font);

my_font_funcs_get() return my font functions that have either nil or my
implementation alternatives.

Thanks,
Tom.



___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master'

2011-05-11 Thread Tom Hacohen
On Tue, 2011-05-10 at 14:17 -0400, Behdad Esfahbod wrote:
 I'm hesitant to offer API for purely optimization purposes.
 
 In this case, it's not even possible to offer a meaningful API since the user
 is free to fetch the glyph array and manipulate it as they wish.  So, if there
 is going to be an API, it has to recalculate the monotonicity result every
 time you call it.  At which point, you may as well just do the check yourself.
I agree, especially since it's very easy to calculate it myself.

 For clusters to be useful they have to be monotonic.  I think we have bugs in
 that right now, but they're bugs that should be fixed.

Yeah, that's right, otherwise you can't really find the source pos of a
given glyph, I wonder what they do with the Indic scripts, because it's
probably a mess there. Maybe an additional source_pos field is needed?

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Inheriting/copying font functions

2011-05-11 Thread Tom Hacohen
Dear Behadad,

After your recent changes (which removed the
hb_font_funcs_get_contour_point_func and the like) and since there's no
way to inherit/copy other func functions. It's now impossible to
implement only part of the font functions and use Harfbuzz's default for
freetype for the rest. Correct me if I'm wrong, but that's at least from
my observation on the exposed API.

Furthermore, do you really think that letting the users set user data
with keys is the way to go? I think just solving the problem of internal
user_data and external user data by having two of those is more than
enough and probably a lot faster. I doubt that anyone will ever need
more than 1 user data once you do the internal/external separation, so
we'll probably just lose precious cpu cycles here.

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Possible memory leaks in latest revision

2011-05-11 Thread Tom Hacohen
Dear all,

Using the attached source code (also available at:
http://pastebin.com/yu3gwvM5 if you find it more convenient) valgrind
complains about a lot of memory leaks in Harfbuzz (latest revision), for
example:

==23594== 64 bytes in 1 blocks are definitely lost in loss record 5 of 6
==23594==at 0x402425F: calloc (vg_replace_malloc.c:467)
==23594==by 0x40BD126: hb_blob_create_sub_blob
(hb-object-private.hh:145)
==23594==by 0x40BFA06: _hb_face_for_data_get_table (hb-font.cc:385)
==23594==by 0x40BF7AE: hb_face_reference_table (hb-font.cc:453)
==23594==by 0x40C4554: _hb_ot_layout_create (hb-ot-layout.cc:60)
==23594==by 0x40BFB47: hb_face_create_for_tables (hb-font.cc:340)
==23594==by 0x40C07D6: hb_face_create_for_data (hb-font.cc:404)
==23594==by 0x40D0571: hb_ft_face_create (hb-ft.cc:215)
==23594==by 0x40D05B5: hb_ft_font_create (hb-ft.cc:253)
==23594==by 0x8048848: hb_stuff (in /tmp/a.out)
==23594==by 0x8048924: main (in /tmp/a.out)
==23594== 
==23594== 400 bytes in 1 blocks are definitely lost in loss record 6 of
6
==23594==at 0x402425F: calloc (vg_replace_malloc.c:467)
==23594==by 0x40CF759: hb_ot_shape_plan_internal (hb-private.hh:255)
==23594==by 0x40CF831: hb_ot_shape (hb-ot-shape.cc:382)
==23594==by 0x40C0E6B: hb_shape (hb-shape.cc:48)
==23594==by 0x804886D: hb_stuff (in /tmp/a.out)
==23594==by 0x8048924: main (in /tmp/a.out)

I found those memory leaks in my application which used to work nicely
(without any leaks) until the recent upgrade and created this test case,
which also leaks, for you to test with.

Since it used to work and the code looks correct, I think it's a memory
leak, but it's possibly my misuse of the API. Please let me know.

Thanks,
Tom.
#include hb-ft.h

FT_Library ft_library;

static void
hb_stuff(FT_Face ft_face)
{
   hb_font_t *hb_font;
   hb_buffer_t *hb_buffer;
   hb_glyph_info_t *hb_glyph;
   const char *text = test;
   int len;

   len = strlen (text);
   hb_buffer = hb_buffer_create (0);
   hb_buffer_add_utf8 (hb_buffer, text, len, 0, len);

   hb_font = hb_ft_font_create (ft_face, NULL);

   hb_shape (hb_font, hb_buffer, NULL, 0);

   hb_font_destroy (hb_font);
   hb_buffer_destroy (hb_buffer);
}
int
main(int argc, char *argv[])
{
   FT_Face ft_face;
   const char *ffile;

   if (argc != 2)
 {
printf(Usage: %s font-file\n, argv[0]);
exit(1);
 }
   ffile = argv[1];
   FT_Init_FreeType (ft_library);
   if (FT_New_Face (ft_library, ffile, 0, ft_face))
 {
printf(Loading %s failed\n, ffile);
exit (1);
 }

   hb_stuff(ft_face);

   FT_Done_Face(ft_face);
   FT_Done_FreeType (ft_library);
}

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] harfbuzz-ng: Branch 'master' - 4 commits

2011-04-27 Thread Tom Hacohen
On Wed, 2011-04-27 at 06:38 -0700, Behdad Esfahbod wrote:
 commit d4bee9f813bb299b1c4aab7c33d588be2a7d354b
 Author: Behdad Esfahbod beh...@behdad.org
 Date:   Wed Apr 27 09:24:37 2011 -0400
 
 [API] Add hb_unicode_funcs_get_default() 

Thanks a lot!

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Hindi scripts shaping support (Devangari and etc)

2011-04-21 Thread Tom Hacohen
Dear all,

How are you? I hope you are well.

I really need Harfbuzz to support those scripts which do not currently
work. I remember that some time ago some people have shown interest in
getting them to work and even someone (don't remember who) said he's
working on it.

I can't read/write any of those languages nor am I familiar with the
Harfbuzz (ng or old) code nor with the OT specifications, but I think
that at this point I will have to try adding this support myself, or at
least try to see what I can do.

I'm sending this email to find out if there's already someone that's
working on it, if so, does he have an ETA? or maybe did something I can
base my work upon? If not, do you guys have any tips (beside reading the
OT specs which I'm doing now, reading the harfbuzz code which I'll do
soon or learn reading Devangari which I don't see happening :P )?

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Hindi scripts shaping support (Devangari and etc)

2011-04-21 Thread Tom Hacohen
Dear Oliver,

From what I've seen it works (tried with Tamil), thank you very much.

Will send a patch with an indic shaper I hacked together in a moment.

Thanks a lot,
Tom.

On Thu, 2011-04-21 at 14:44 +0200, Olivier BERTEN wrote:
 As far as I can tell, Harfbuzz already supports these scripts. I'm
 currently testing hb-view for Khmer script and it works like a charm, as
 long as the khmr script is defined in the font. If not, you just need to
 tell which opentype features hb should use.
 
 Olivier
 
 Le 21/04/11 12:39, Tom Hacohen a écrit :
  Dear all,
 
  How are you? I hope you are well.
 
  I really need Harfbuzz to support those scripts which do not currently
  work. I remember that some time ago some people have shown interest in
  getting them to work and even someone (don't remember who) said he's
  working on it.
 
  I can't read/write any of those languages nor am I familiar with the
  Harfbuzz (ng or old) code nor with the OT specifications, but I think
  that at this point I will have to try adding this support myself, or at
  least try to see what I can do.
 
  I'm sending this email to find out if there's already someone that's
  working on it, if so, does he have an ETA? or maybe did something I can
  base my work upon? If not, do you guys have any tips (beside reading the
  OT specs which I'm doing now, reading the harfbuzz code which I'll do
  soon or learn reading Devangari which I don't see happening :P )?
 
  Thanks a lot,
  Tom.
 
  ___
  HarfBuzz mailing list
  HarfBuzz@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/harfbuzz
 
 
 ___
 HarfBuzz mailing list
 HarfBuzz@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/harfbuzz


___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] [PATCH] Added an Indic shaper

2011-04-21 Thread Tom Hacohen
Dear all,

Thanks to Olivier Berten who let me know that all I need is to tell hb
which opentype features I want to use in order for Indic to work, I got
Indic scripts to work.

As said before, I can't read these languages, but from what I have seen,
it works like a charm. I just took the list of features used in
Harfbuzz.old and hacked together an Indic shaper.

Attached is a patch implementing that shaper.

I don't know if adding those features is really enough, nor am I sure
they need to be applied on all the scripts I applied them all, but this
patch gets the job done. It's now roughly the same as the Arabic shaper.

Let me know if you have any comments.

Thanks,
Tom.

P.S
Why don't we use the init feature by default?
From 6d85220e15fdbb68a8ebf831558ac1c4e3687a23 Mon Sep 17 00:00:00 2001
From: Tom 'TAsn' Hacohen tom.haco...@partner.samsung.com
Date: Thu, 21 Apr 2011 17:33:45 +0300
Subject: [PATCH] [Shaping] Added complex indic shaper.

Currently I only add features that make sense for the various indic
scripts. I just took the list of features from Harfbuzz.old, tweaked a
bit and put it there. I don't speak those languages so I don't know if
it's enough, but at least from my tests it looks good.
---
 src/Makefile.am|1 +
 src/hb-ot-shape-complex-indic.cc   |   55 
 src/hb-ot-shape-complex-private.hh |   15 +-
 src/hb-ot-shape-private.hh |3 +-
 4 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 src/hb-ot-shape-complex-indic.cc

diff --git a/src/Makefile.am b/src/Makefile.am
index 70c51d1..49ddc79 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,6 +50,7 @@ HBSOURCES += \
 	hb-ot-shape.cc \
 	hb-ot-shape-complex-arabic.cc \
 	hb-ot-shape-complex-arabic-table.h \
+	hb-ot-shape-complex-indic.cc \
 	hb-ot-shape-complex-private.hh \
 	hb-ot-shape-private.hh \
 	hb-ot-tag.c \
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
new file mode 100644
index 000..325b9f5
--- /dev/null
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -0,0 +1,55 @@
+/*
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN AS IS BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Author(s): Tom Hacohen t...@stosb.com
+ */
+
+#include hb-ot-shape-complex-private.hh
+
+HB_BEGIN_DECLS
+
+static const hb_tag_t indic_features[] =
+{
+  HB_TAG('a', 'b', 'v', 's'),
+  HB_TAG('a', 'k', 'h', 'n'),
+  HB_TAG('b', 'l', 'w', 'f'),
+  HB_TAG('b', 'l', 'w', 's'),
+  HB_TAG('c', 'j', 'c', 't'),
+  HB_TAG('h', 'a', 'l', 'f'),
+  HB_TAG('h', 'a', 'l', 'n'),
+  HB_TAG('i', 'n', 'i', 't'),
+  HB_TAG('n', 'u', 'k', 't'),
+  HB_TAG('p', 'r', 'e', 's'),
+  HB_TAG('p', 's', 't', 'f'),
+  HB_TAG('p', 's', 't', 's'),
+  HB_TAG('r', 'p', 'h', 'f'),
+  HB_TAG('v', 'a', 't', 'u'),
+};
+
+void
+_hb_ot_shape_complex_collect_features_indic	(hb_ot_shape_plan_t *plan, const hb_segment_properties_t  *props)
+{
+  unsigned int num_features = sizeof(indic_features);
+  for (unsigned int i = 0; i  num_features; i++)
+plan-map.add_bool_feature (indic_features[i], true);
+}
+
+HB_END_DECLS
diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh
index 8147945..aa0f758 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex-private.hh
@@ -45,7 +45,17 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
 case HB_SCRIPT_MANDAIC:
 case HB_SCRIPT_MONGOLIAN:
   return hb_ot_complex_shaper_arabic;
-
+case HB_SCRIPT_BENGALI:
+case HB_SCRIPT_DEVANAGARI:
+case HB_SCRIPT_GUJARATI:
+case HB_SCRIPT_GURMUKHI:
+case HB_SCRIPT_KANNADA:
+case HB_SCRIPT_MALAYALAM:
+case HB_SCRIPT_ORIYA:
+case HB_SCRIPT_SINHALA:
+case HB_SCRIPT_TAMIL:
+case HB_SCRIPT_TELUGU:
+  return hb_ot_complex_shaper_indic;
 default:
   return hb_ot_complex_shaper_none;
   }
@@ -63,12 +73,15 @@ hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
 
 HB_INTERNAL void _hb_ot_shape_complex_collect_features_arabic

Re: [HarfBuzz] [PATCH] Added an Indic shaper

2011-04-21 Thread Tom Hacohen
On Thu, 2011-04-21 at 15:54 +0100, Jonathan Kew wrote:
 I'm afraid this is _not_ sufficient to get correct rendering of most (all?) 
 Indic scripts. In addition to the application of OpenType features, Indic 
 scripts require reordering of certain characters; for example, some vowel 
 marks such as the Devanagari short I are encoded following a consonant 
 (cluster) but must be reordered before it for rendering. OpenType features do 
 not handle this; it is the responsibility of the shaping engine.
 
 Also, some of the OT features need to be applied selectively only to certain 
 characters within the Indic syllable, not indiscriminately to all the text.
 

Seeing the complexity of Harfbuzz.old's indic shaper, I figured as much,
but thanks for the verification. As I said, I can't read any of those,
and my tests looked like pango so I hoped everything was fine.

So what's next? How can I further advance the creation of a proper Indic
shaper? What do you guys do in Firefox?

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] [PATCH] Added an Indic shaper

2011-04-21 Thread Tom Hacohen
On Fri, 2011-04-22 at 00:12 +0900, suzuki toshiya wrote:
 Although init feature is not forbidden in Indic scripts,
 basic Indic shaping algorithm is defined without init
 feature, like,
 http://www.microsoft.com/typography/otfntdev/devanot/features.aspx
 
 I guess the usage of init for script support is for the
 script that the presentation forms of a character can be
 classified into 4 types: initial/medial/final/isolated,
 aslike Arabic. The classification of the presentation forms
 of Indic character might be different from 4-form model.

Ok, this whole tag concept got me confused, I think I get it now.

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Why does kerning modify glyph advance?

2011-02-14 Thread Tom Hacohen
On Mon, 2011-02-14 at 14:42 +, Jonathan Kew wrote:
 Modifying x_offset alone would adjust the position of a glyph but not the 
 position of any following glyphs, which is not the effect you want kerning to 
 have. (OTOH, it's usually appropriate for things like accent positioning.)
Oh, good answer, thanks.
 (How would you expect to make use of caching the x_advance of a char? Did 
 you perhaps mean glyph here, rather than character? *Character* advances are 
 context-dependent even without the presence of kerning, as there might be 
 contextual substitutions that give you entirely different glyphs.)
I'm aware of that situation, I was actually referring to caching of it
per strings so I'll be able to know the sizes of parts of the string
without needing to recalculate them, but nvm.

Thanks a lot,
Tom.


___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Query regarding the state if the Indic shaper

2011-02-02 Thread Tom Hacohen
Dear all,

Is there any progress regarding the Indic shaper? I remember seeing many
people here showing interest in writing one, has anyone done so?
What's the updated ETA for the Indic shaper?

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] How to override Harfbuzz's freetype functions?

2011-02-01 Thread Tom Hacohen
On Tue, 2011-02-01 at 14:03 -0500, Behdad Esfahbod wrote:
Thank you very much, weird that I missed it.

 I'm not quite satisfied with this scheme.  The problem with it is that if/when
 new callbacks are added to hb_font_funcs_t, your code needs to be updated to
 relay those.  Would have been much nicer if they falled through automatically
 (so you could in essence really subclass a font_funcs_t).  I'll think more
 about it to see if I can make that happen.

I guess you should add docs that suggest people to use
hb_ft_get_font_funcs (or whatever engine they are using) or something
to set the base and then they should override.

Anyhow, thanks a lot, weird I missed it, because I did skimmed through
the headers.

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Template or sample code for writing a shaper for harfbuzz-ng?

2010-12-29 Thread Tom Hacohen
On Wed, 2010-12-29 at 14:27 +0530, Arjuna Rao Chavala wrote:
 I am also interested, as I would like to support to ensure the
 languages that I know Telugu, Hindi and Kannda are supported fine with
 the new shaper.

I would also like that, because I would like seeing a shaper for those
languages (although I speak none of them) :P

Isn't the Arabic shaper a good enough example for new shapers? (I
honestly don't know, I'm just asking).

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Who is responsible for Devanagari reordering?

2010-12-19 Thread Tom Hacohen
Dear all,

I know there's no Indic support in Harfbuzz just yet, but still, when
there will be, who is responsible for Indic reordering? Harfbuzz? Or is
there another lib/will have to write it myself?

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Who is responsible for Devanagari reordering?

2010-12-19 Thread Tom Hacohen
On Sun, 2010-12-19 at 05:16 -0500, Behdad Esfahbod wrote:
 HarfBuzz will do it all for you.  We don't expect users of HarfBuzz to even
 know about the delicate details of various scripts.

Good to know.

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Optmizing code using Harfbuzz

2010-11-07 Thread Tom Hacohen
On Thu, 2010-11-04 at 13:54 -0400, Behdad Esfahbod wrote:
 Unless you show us some hard profiling data, I don't think there's much I can
 do.  If it's good to run Firefox and GNOME, it out to be fast enough for a
 mobile screen...  If you don't do anything else, it's no surprise that
 harfbuzz is taking 95% of the time.  That doesn't mean anything.

Obviously if I don't do anything else 95% is not much, but I do. Anyhow,
as I said my reply to Keith, I think the problem was actually me
destroying the harfbuzz cache too often, I'll address that and let you
know if I find it's harfbuzz's fault.

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Arabic vowels and shaping - incomplete behavior

2010-10-27 Thread Tom Hacohen
Hey,

Is it just me, or do vowels break shaping in Arabic? If so, what should
be done to fix it? I can't think of a way of solving it, maybe only
removing the vowels, shaping without them and then adding previously
shaped glyphs, and then vowels and then the glyphs again and reshaping,
but that's annoying

Any ideas? Example text that works in gtk but doesn't with my
implementation:

ضَلُّو

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Arabic vowels and shaping - incomplete behavior

2010-10-27 Thread Tom Hacohen
On Wed, 2010-10-27 at 09:48 -0400, Behdad Esfahbod wrote:
 Maybe you can attach a screenshot at least?

I just get isolated forms of all of them, anyhow, screenshot attached.

But please also look at the bottom of the previous message where I
described a SEGFAULT I was getting and also what I think I did wrong
that made it not work in the first place.

--
Tom.


attachment: Screenshot-Notepad-1.png___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Arabic vowels and shaping - incomplete behavior

2010-10-27 Thread Tom Hacohen
On Wed, 2010-10-27 at 10:41 -0400, Behdad Esfahbod wrote:
 On 10/27/10 09:19, Tom Hacohen wrote:
  because c-buffer-info[i].gproperty == 65535
  So I think there's still an issue.
 
 Fixed that too.  Pushed out.

Cool to know my assumptions were correct.
Thank you very much, works like a charm.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Getting the number of Graphmes for a ligature

2010-10-26 Thread Tom Hacohen
On Mon, 2010-10-25 at 21:21 -0400, Behdad Esfahbod wrote:
 That's how it should be done in the current design, and what Pango does
 indeed.  For the last cluster, you need to take the length of the original
 text into account, yes.  I've been thinking about adding a sentinel item at
 the end of the buffer to help with that (setting the cluster index to the
 position after all text), but that fails in the rtl situation.

Thank you very much, I'll do just that.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] A couple of clarifications regarding HarfBuzz

2010-10-26 Thread Tom Hacohen
On Mon, 2010-10-25 at 21:23 -0400, Behdad Esfahbod wrote:
 Not yet.  But you can use hb_unicode_get_combining_class().

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] What's the correct Create/Destory usage of hb_ft_face/font ?

2010-10-26 Thread Tom Hacohen
Hey all,

I don't understand what's the correct way of using those.

Currently I just:
   hb_face = hb_ft_face_create(face, NULL);
   hb_font = hb_ft_font_create(face, NULL);

   hb_font_destroy(hb_font);
   hb_face_destroy(hb_face);

But I think I'm doing something wrong, as I get:
==32762== 4,928 bytes in 88 blocks are definitely lost in loss record 95
of 98
==32762==at 0x402425F: calloc (vg_replace_malloc.c:467)
==32762==by 0x45E28E1: hb_blob_create
(in /opt/e17/lib/libharfbuzz.so.0.0.0)
==32762==by 0x45F4F91: hb_ft_face_create
(in /opt/e17/lib/libharfbuzz.so.0.0.0)


What am I doing wrong?

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] What's the correct Create/Destory usage of hb_ft_face/font ?

2010-10-26 Thread Tom Hacohen
On Tue, 2010-10-26 at 11:14 -0400, Behdad Esfahbod wrote:
 Can you try with master?  I remember I fixed a blob leak a while ago...

I'm with the latest harfbuzz from the master branch.
Latest commit: 39dede9e732f78cbd092ccb3b48d77ddd66d from the 13th of
October.

--
Tom.


___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] What's the correct Create/Destory usage of hb_ft_face/font ?

2010-10-26 Thread Tom Hacohen
On Tue, 2010-10-26 at 11:28 -0400, Behdad Esfahbod wrote:
 Fixed it in master right now.

Looks like that fixed it, thank you very much.

--
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Getting the number of Graphmes for a ligature

2010-10-25 Thread Tom Hacohen
Hey all,

I wonder, is there a way to get the number of Graphmes for a ligature?
I can just take the cluster index and the next cluster index (or in rtl
texts the other way around) and by that find the number of items,  but
this means I will have to handle the special case of just one ligature
in the text (because I won't have a next item).

Thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] A couple of clarifications regarding HarfBuzz

2010-10-24 Thread Tom Hacohen
Dear Behdad,

My replies are below.

On Thu, 2010-10-21 at 14:55 -0400, Behdad Esfahbod wrote:
 It's more than just Latin.
Yeah, also Yiddish and Hebrew, Arabic and Persian I know them, they just
didn't pop to my head.
 

 If you have UTF-32 or UTF-16, just pass the length indeed.  For UTF-8, passing
 the byte length will overshoot by a factor of 2 or 3 for anything but ASCII.
 You need the # of characters, not # of bytes, etc.

I'm working with UTF-32 anyway. But yes, of course # of chars and not
byte len.
 Graphemes are what a user (of a language) considers to be one entity.  Unicode
 defines them:
 
   http://www.unicode.org/reports/tr29/
 
 We may  add code in harfbuzz for that in the future.  A cheap heuristic is to
 check for combining-class=0.

Thank you very much. But does HarfBuzz expose such info? (combining
class), as I didn't see anything about it.

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] A couple of clarifications regarding HarfBuzz

2010-10-21 Thread Tom Hacohen
Hi Behdad,

Thanks a lot for your response, my comments are below:

On Wed, 2010-10-20 at 20:17 -0400, Behdad Esfahbod wrote:
 Yes, that's it.  It's more than plain reversal at the end though.  You get the
 direction from the output of UAX#9 (eg. FriBidi).
What does it do more than a plain reversal? And yes, I got the direction
from FriBiDi.
 
 Language is used to do language-specific adjustments when appropriate.  You
 typically just pass the locale or whatever your higher-level tells you (think
 of lang attribute in html) to hb_language_from_string.
As I thought, thanks, I wasn't thinking about languages using the same
script like many of the latin languages and their ligatures.

 
 Some of the fallbacks and specific details wouldn't work.  For example,
 mirroring would not work, which means that you would get incorrect result when
 brackets are used in Arabic.
 
 Also, Jonathan Kew has some code in Firefox to implement those.  You may want
 to check them out.
Thank you very much, I will.

 
 HarfBuzz does the right thing no matter what you pass in.   So you can safely
 pass 0.  String length in characters would be most appropriate if you have it.
I assumed HarfBuzz does well anyway, but I want the fastest way
possible. Ok then, I have the string's length (as it's needed for
buffer_add anyway).

 Those are OpenType features.  You can ignore them for now I would say.
Thank you very much.

 The output glyphs have a member called -cluster, which points to the start
 index of the cluster a glyph is part of.
Oh, very nice, thanks.

 The low-level API to fetch that information from GDEF is available through
 hb_ot_layout_get_lig_carets(), however, very few fonts provide such
 information.  It's common to just divide the width by the number of graphemes.
graphemes being non diacritic glyphs?

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] A couple of clarifications regarding HarfBuzz

2010-10-20 Thread Tom Hacohen
Dear all,

I have a couple of questions about things I don't completely understand.
1. What does the direction in hb_buffer mean (I'm only talking about LTR
and RTL, TTB and BTT have more implications)? From what I've seen, it
only controls whether it should reverse the order of buffer, or not.
2. What does language (in hb_buffer) does? Isn't script enough?
3. What's the implications of working without setting Unicode functions?
I don't want to depend on GLib/ICU, and I want to know if I should take
the effort of implementing my own.
4. I assume the parameter to hb_buffer_create is for allocating the
needed space as a single bulk and thus avoiding memory fragmentation,
but how much should I allocate? I mean, I don't know HarfBuzz's
internals to guess, should I just pass my string's length? Will harfbuzz
do the needed calculations?
5. What do the features in hb_shape stand for and how do I manipulate
them? (I assume this question is because my lack of knowledge and not
HarfBuzz's lack of docs).
6. How can I translate an index in the buffer to an index in the
pre-shaped string? (Because indexes may change because of ligatures)
7. That's maybe not completely HarfBuzz related, but how do I get the
pen positions inside a ligature? (for drawing cursor, handling
selection, etc etc) or should I just treat the ligature as one group
once it has shaped into one?

I'll probably have more questions later, but those are the basic ones I
have, thanks,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] A couple of clarifications regarding HarfBuzz

2010-10-20 Thread Tom Hacohen
On Wed, 2010-10-20 at 17:50 +0200, Khaled Hosny wrote:
 Each OpenType lookup is associated with script(s) and language(s) where
 it should be active.
Oh, right, didn't think about those Latin users, my bad. What's the best
way to detect languages? Just use locale? or is there a better way?
 There is the ligature caret in GDEF table (I don't know how HB presents
 such data), but most fonts don't have such carets set so you may want to
 divide the ligature into equal parts by the number of its components
 (may be HB already does such thing?), see:
 http://weblogs.mozillazine.org/roc/archives/2006/10/partial_ligatur.html
I thought about splitting the coords to the number of components, but I
don't know the mapping between harfbuzz indexes and the original ones
(see question #6).

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Request for quick/small Harfbuzz usage flow

2010-10-13 Thread Tom Hacohen
Dear all,

I need harfbuzz for diacritic positioning and character shaping (in many
languages), or at least this is what I know I need from Harfbuzz now, am
I missing anything? Is there anything more Harfbuzz does that I might be
interested in?

Anyhow, I would like, if possible, since there's no manual to read yet,
to have a short list of functions worth taking a look at. I of course
don't expect code snippets or anything a like, just what functions and
data types I need to know about in order to use Harfbuzz for the
purposes mentioned above, or even the usage flow.

Thanks in advance,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] Intro to HarfBuzz

2010-08-30 Thread Tom Hacohen
Dear all,

My name is Tom and I work on the Hebrew and Arabic support of
enlightenment.org (efl/e17).

Until now, I based my work on the FriBiDi shaper. I've heard the name
HarfBuzz in the past, and was planning to use it for a while now, and
the lack of ligatures support in FriBiDi was the final incentive for the
migration.

I looked in Pango's and HarfBuzz's source code a bit and I have a couple
of questions:
1. What can HarfBuzz do? I know it can shape and help finding correct
line breaks what else? Are the features I mentioned correct? Is there a
text somewhere that explains a bit about HarfBuzz?
2. How does it interact with FreeType?
3. I noticed that the shaper code accepts 16bit unicode strings, why not
32? Should I convert my 32code points to 16 before calling to the HB
functions? Or is there a better way? (A secret set of 32bit
functions ;P).

I think those questions are enough to get me started.

Thanks a lot,
Tom.

___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] Intro to HarfBuzz

2010-08-30 Thread Tom Hacohen
On Mon, 2010-08-30 at 15:24 +0530, arjuna rao chavala wrote:

 Please check this 

Thanks, looks like exactly what I was looking for, although I already
went through some of the links you gave in the past, I found new info I
haven't read already. Will read it today/tomorrow.

Again, thanks,
Tom.


___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz