Re: [HarfBuzz] Building harfbuzz-ng using Android NDK

2012-06-04 Thread Shiva Kumar H R
The Android widget that I had created sometime ago, that allows Indic text
to be rendered on an Android phone at an application level (without having
to root the phone), by making use of HarfBuzz-ng and FreeType libraries, is
open-sourced on http://code.google.com/p/indic-text-renderer/ .

-- 
Thanks & Regards,
Shiva Kumar H R


On Wed, Sep 21, 2011 at 10:29 PM, Shiva Kumar H R  wrote:

> Hi,
> I am glad to inform that I could use HarfBuzz-ng and FreeType to render
> Indic text on Android Canvas.
>
> Thank you for creating such an elegant lightweight library.
>
> I referred https://github.com/anoek/ex-sdl-cairo-freetype-harfbuzz to
> come up with my sample program, the essence of which looks as below:
>
>  start of indic-text-rendering code snippet -
>
> #include 
> ...
> void drawIndicText(unsigned short* text, int textLength, int xStart, int
> yBaseLine, int charHeight) {
> FT_Library ft_library;
> FT_Init_FreeType(&ft_library); /* initialize library */
>
> char* fontFilePath =
> "/sdcard/Android/data/org.iisc.mile.indictext.android/Lohit-Kannada.ttf";
> FT_Face ft_face;
> FT_New_Face(ft_library, fontFilePath, 0, &ft_face); /* create face
> object */
>
> hb_font_t *font = hb_ft_font_create(ft_face, NULL);
>
> FT_Set_Pixel_Sizes(ft_face, 0, charHeight); /* set character size */
>
> /* Create a buffer for harfbuzz to use */
> hb_buffer_t *buffer = hb_buffer_create();
>
> //hb_buffer_set_direction(buffer, HB_DIRECTION_LTR); /* or LTR */
> hb_buffer_set_script(buffer, HB_SCRIPT_KANNADA); /* see hb-unicode.h */
> //hb_buffer_set_language(buffer, hb_language_from_string("ka"));
>
> /* Layout the text */
> hb_buffer_add_utf16(buffer, text, textLength, 0, textLength);
> hb_ot_shape(font, buffer, NULL, 0, 0);
>
> int glyph_count = hb_buffer_get_length(buffer);
> hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buffer, 0);
> hb_glyph_position_t *glyph_pos = hb_buffer_get_glyph_positions(buffer,
> 0);
>
> for (int i = 0; i < glyph_count; i++) {
> FT_UInt glyph_index = glyph_info[i].codepoint;
> FT_Error error = FT_Load_Glyph(ft_face, glyph_index,
> FT_LOAD_DEFAULT);
> if (error) {
> continue; /* ignore errors */
> }
> /* convert to an anti-aliased bitmap */
> error = FT_Render_Glyph(ft_face->glyph, FT_RENDER_MODE_NORMAL);
> if (error) {
> continue;
> }
>
> /* now, draw to our target surface (convert position) */
> FT_GlyphSlot slot = ft_face->glyph;
> draw_bitmap(&slot->bitmap, xStart + slot->bitmap_left, yBaseLine -
> slot->bitmap_top);
> int glyphPosX = xStart + glyph_pos[i].x_offset;
> int glyphPosY = yBaseLine - glyph_pos[i].y_offset;
> //draw_bitmap(&slot->bitmap, glyphPosX, glyphPosY, env, thiz,
> lock);
>
> /* increment pen position */
> xStart += slot->advance.x >> 6;
> //xStart += glyph_pos[i].x_advance / 64;
> }
>
> hb_buffer_destroy(buffer);
>
> hb_font_destroy(font);
> FT_Done_Face(ft_face);
> FT_Done_FreeType(ft_library);
>
> return;
> }
> ...
>  end of indic-text-rendering code snippet -
>
> Few things I noticed:
> 1) I had earlier used hb_shape() but that didn't work. It worked when I
> used hb_ot_shape(). Is this by design?
>
> 2) There are a few errors in the sequence of glyphs returned by HarfBuzz
> for certain Kannada language words. In the attached snapshot, words in
> second edit-box are not rendered properly. Where should I report these
> errors and in what format?
>
> I see a test case in
> http://cgit.freedesktop.org/harfbuzz/tree/test/test-shape-complex.c . But
> I couldn't figure out how to run this. Simply running
> test-shape-complex.exe didn't help. Are there some instructions that I can
> look at?
>
>
> --
> Thanks & Regards,
> Shiva Kumar H R
> http://people.apache.org/~shivahr/
>
> On Fri, Sep 16, 2011 at 5:05 PM, Shiva Kumar H R wrote:
>
>> I have used a simple Android.mk as below and got the HarfBuzz to build on
>> Android NDK. I got below warnings though.
>>
>> harfbuzz-ng/src/hb-object-private.hh:74:2: warning: #warning "Could not
>> find any system to define atomic_int macros, library will NOT be
>> thread-safe"
>>
>> Android.mk:
>> --Begin of Android.mk---
>> BASE_PATH := $(call my-dir)
>> LOCAL_PATH:= $(call my-dir)
>>
>> #
>> #   build the harfbuzz library
>> #
>>
>> include $(CLEAR_VARS)
>>
>> LOCAL_ARM_MODE := arm
>>
>> LOCAL_MODULE_TAGS := optional
>>
>> LOCAL_CPP_EXTENSION := .cc
>>
>> LOCAL_SRC_FILES:= \
>> src/hb-blob.cc \
>> src/hb-buffer.cc \
>> src/hb-common.cc \
>> src/hb-fallback-shape.cc \
>> src/hb-font.cc \
>> src/hb-ot-tag.cc \
>> src/hb-shape.cc \
>> src/hb-tt-font.cc \
>> src/hb-unicode.cc \
>> src/hb-ot-layout.cc \
>> src/hb-ot

[HarfBuzz] Harfbuzz Sinhala (si) script support status update

2012-06-04 Thread Harshula
Hi Behdad,

I tested the recent Harfbuzz Indic code changes. The correctness of
Sinhala script layout/rendering has improved significantly.

1) Notably, "Bug 45114 - Enable ZWJ in lookups for Sinhala and
Malayalam" (https://bugs.freedesktop.org/show_bug.cgi?id=45114) has been
fixed by the following commit by removing the offending code:

--
commit d1deaa2f5bd028e8076265cba92cffa4fa2834ac
Author: Behdad Esfahbod 
Date:   Wed May 9 15:04:13 2012 +0200

Replace zerowidth invisible chars with a zero-advance space glyph

Like Uniscribe does.
--

2) Once "Bug 50706 - [si] harfbuzz does not render diga kombuva (U+0DDA)
correctly when combined with a
consonant" (https://bugs.freedesktop.org/show_bug.cgi?id=50706) is
fixed, Sinhala script support should be sufficient for public
consumption.

3) Also keep in mind that a Sinhala 'Virama' (Al-Lakuna) does NOT create
implicit conjuncts when surrounded by consonants. In Pango and ICU I had
to change the state table to add a separate al-lakuna column.

cya,
#

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


Re: [HarfBuzz] Language Script name needs update

2012-06-04 Thread Behdad Esfahbod
Fixed.  Thanks.

This was imported from UTRRS.

behdad

On 06/04/2012 10:18 AM, APreetalam wrote:
> Hi
> I found there is 'Punjabi' name used (for script) in
> 
> harfbuzz/test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi
> 
> although it may has small effect, but can corrected as there are
> two script for Punjabi [Gurmukhi and Shahmukhi] [1]
> 
> 
> Thanks
> A S Alam
> [1] http://en.wikipedia.org/wiki/Punjabi_language#Writing_system
> ___
> 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] harfbuzz-ng: Branch 'master' - 2 commits

2012-06-04 Thread Behdad Esfahbod
 test/shaping/texts/in-tree/shaper-indic/indic/MANIFEST 
   |2 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/MANIFEST 
   |2 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/misc/MANIFEST
   |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/misc/misc.txt
   |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/LICENSE
   |   19 +
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/MANIFEST   
   |3 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/README 
   |   13 
 test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/SOURCES
   |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-Consonants.txt
|   38 ++
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-DependentVowels.txt
   |9 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-Digits.txt
|   10 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-GurmukhiSpecific.txt
  |6 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-IndependentVowels.txt
 |   10 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-Reserved.txt
  |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/IndicFontFeatureCodepoint-VariousSigns.txt
  |6 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/codepoint/MANIFEST
|7 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/gpos/IndicFontFeatureGPOS-AboveBase.txt
   |   22 +
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/gpos/IndicFontFeatureGPOS-BelowBase.txt
   |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/gpos/MANIFEST
 |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/gsub/IndicFontFeatureGSUB.txt
 |  152 ++
 
test/shaping/texts/in-tree/shaper-indic/indic/script-gurmukhi/utrrs/gsub/MANIFEST
 |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/MANIFEST  
   |2 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/misc/MANIFEST 
   |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/misc/misc.txt 
   |1 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/LICENSE 
   |   19 -
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/MANIFEST
   |3 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/README  
   |   13 
 test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/SOURCES 
   |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-Consonants.txt
 |   38 --
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-DependentVowels.txt
|9 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-Digits.txt
 |   10 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-GurmukhiSpecific.txt
   |6 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-IndependentVowels.txt
  |   10 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-Reserved.txt
   |2 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/IndicFontFeatureCodepoint-VariousSigns.txt
   |6 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/utrrs/codepoint/MANIFEST
 |7 
 
test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi/ut

[HarfBuzz] Language Script name needs update

2012-06-04 Thread APreetalam

Hi
I found there is 'Punjabi' name used (for script) in

harfbuzz/test/shaping/texts/in-tree/shaper-indic/indic/script-punjabi

although it may has small effect, but can corrected as there are
two script for Punjabi [Gurmukhi and Shahmukhi] [1]


Thanks
A S Alam
[1] http://en.wikipedia.org/wiki/Punjabi_language#Writing_system
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] harfbuzz-ng: Branch 'master'

2012-06-04 Thread Behdad Esfahbod
 src/hb-ot-shape-complex-indic.cc |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9fc7a11469113d31d8095757c4fc038c3427d44a
Author: Behdad Esfahbod 
Date:   Mon Jun 4 08:28:19 2012 -0400

Remove comma at the end of enum

As reported by Jonathan Kew on the list.

diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0c5479e..53ce263 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -617,7 +617,7 @@ final_reordering_syllable (hb_buffer_t *buffer, hb_mask_t 
*mask_array,
REPH_BEFORE_SUBSCRIPT,
REPH_AFTER_SUBSCRIPT,
REPH_BEFORE_POSTSCRIPT,
-   REPH_AFTER_POSTSCRIPT,
+   REPH_AFTER_POSTSCRIPT
  } reph_pos;
 
  /* XXX Figure out old behavior too */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


[HarfBuzz] comma at end of enum list may break the build

2012-06-04 Thread Jonathan Kew

Some strict compilers will reject this as not being standard C++.

Patch attached (from mozilla bug 
https://bugzilla.mozilla.org/show_bug.cgi?id=761019).


JK
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0c5479e..53ce263 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -617,7 +617,7 @@ final_reordering_syllable (hb_buffer_t *buffer, hb_mask_t 
*mask_array,
REPH_BEFORE_SUBSCRIPT,
REPH_AFTER_SUBSCRIPT,
REPH_BEFORE_POSTSCRIPT,
-   REPH_AFTER_POSTSCRIPT,
+   REPH_AFTER_POSTSCRIPT
  } reph_pos;
 
  /* XXX Figure out old behavior too */
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


Re: [HarfBuzz] [p-c] Perso-Arabic symbols for "year"

2012-06-04 Thread Khaled Hosny
Thanks, I fixed the eight issue.

Regards,
 Khaled

On Mon, Jun 04, 2012 at 11:46:13AM +0530, Connie Bobroff wrote:
> Khaled,
> Thanks and congratulations. The new Amiri works great on Firefox. All 4 digits
> are nicely above the Arabic Number Sign. (Just note that if the right-most
> digit is "8", the bottom, right portion collides with the Arabic Number Sign a
> bit. But no big deal.
> I think the other points, many of which are critical issues, need to be taken
> up in a separate thread. Please hang on.
> 
> 
>  
> On Mon, Jun 4, 2012 at 11:02 AM, Khaled Hosny  wrote:
> 
> On Mon, Jun 04, 2012 at 08:26:47AM +0530, Connie Bobroff wrote:
> > Khaled,
> > Yes, please send the version of Amiri that works on Firefox. The latest
> version
> > from SourceForge works very nicely on IE but not Firefox.
> 
> File attached.
> 
> > Amiri is nice in that it's relatively the same size as Tahoma and
> > therefore, much more suitable for web use than the others.
> 
> That is by design, almost all Arabic fonts are ridiculously too small
> compared to Latin for reason beyond me, making it impossible to use the
> same point size for Arabic and non-Arabic text.
> 
> > (However, for this particular project, unfortunately, I won't be able
> > to use it since the Heh Goal is not the right shape to match the old
> > style manuscript.)
> 
> This was intentional, IMO many of the variant Arabic letters in Unicode
> are really stylistic variants specific to certain calligraphic style
> commonly used for certain languages, Heh Goal is such an example, it is
> a Nastliq-style variant of the regular Heh and a calligrapher writing
> Heh this way will do so even when writing Arabic or any other language
> using Arabic script, the same applies for the so-called Keheh or Farsi
> Kaf which is really a Nastaliq Kaf, and Arabic calligraphers writing in
> Nastaliq use that very same Kaf. So for Amiri, being a Naskh style font,
> I decided that this variance makes no sense and does not match the
> design so I ignored it, however if there is evidence of manuscripts in
> Naskh style making that distinction I'll happily follow it.
> 
> > I did not quite see until now these "Advanced Features" on SIL which say
> how
> > many digits the font allows:
> > http://scripts.sil.org/cms/scripts/page.php?item_id=ArabicFonts
> > Probably there should be a discussion somewhere about using "Arabic
> Number
> > Sign" for dates and therefore needing 4 digits. I presume "Arabic Sign
> Samvat"
> > will be given 4 digits but as I said, it's the wrong shape at least for
> me in
> > this project.
> 
> The problem is that I don’t really know what is the intended use of the
> Arabic number sign, the available Unicode proposals that supposedly lead 
> to
> its
> inclusion do not say much about it:
> http://std.dkuug.dk/jtc1/sc2/wg2/docs/n2413.htm
> 
> This page says it is “used to indicate the beginning of a number” which
> does not say much either, but suggests it takes an arbitrary number
> digits, so I extended Amiri’s number sign to accept 4 digits:
> http://people.w3.org/rishida/scripts/urdu/
> 
> Regards,
>  Khaled
> 
> > -Connie
> >
> > On Sun, Jun 3, 2012 at 10:42 PM, Behdad Esfahbod 
> wrote:
> >
> >     On 06/03/2012 12:19 PM, Khaled Hosny wrote:
> >     > This have been fixed in FontForge’s master branch, it will break
> feature
> >     > files expecting the older behaviour, but there is not much we can
> do
> >     > here, and it is hardly the only incompatible fix to FontForge’s
> feature
> >     > file code since the last release.
> >
> >     Thanks Khaled.  I still don't have any idea how to correctly handle
> these
> >     sequences in HarfBuzz, but will experiment with Uniscribe, try to 
> see
> if I
> >     can
> >     figure out what it's doing.
> >
> >     behdad
> >
> >
> 
> 
___
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz