Behdad Esfahbod | 2 Mar 2011 05:20
Favicon
Gravatar

Re: hb-view

Hi Sebastien,

On 02/23/11 12:57, Sebastien Metrot wrote:
> Hello Behdad,
> 
> If you plan to add a dependency to glib, do you think there is a way to make that optional? I already use an
alternative implementation of the bidi algorithm (UCPGA, "Pretty Good Bidi Algorithm", from the UCData
lib) and I'd rather not have to deal with glib as it is notoriously hard to build on non unix platforms. I
confess, however, that I have no idea how it compares to fribidi.

Right.  That's the kind of feedback I was looking for.  But, if I don't use
glib (and FriBidi if we decide that we want full bidi in hb-view), then your
build on non-unix will be only partially functional unless you have hb-view
yourself to add your own UCData and bidi.

I'll try to keep the glib use to the minimum.

behdad

> Regards,
> 
> S.
> 
> 
> On Feb 23, 2011, at 12:17 AM, Behdad Esfahbod wrote:
> 
>> Hello everyone,
>>
>> As promised, I pushed out the initial code for a hb-view cmdline tool.
>> There's a thousand things missing right now, but it's a good start.
(Continue reading)

Behdad Esfahbod | 2 Mar 2011 05:20

harfbuzz-ng: Branch 'master'

 src/Makefile.am |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c2cb98c8185c5560cfd04de7ee7c64c9496b986c
Author: Behdad Esfahbod <behdad@...>
Date:   Tue Mar 1 23:18:09 2011 -0500

    [hb-view] Link with -lm

diff --git a/src/Makefile.am b/src/Makefile.am
index 8e8319f..88aadf5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
 <at>  <at>  -118,7 +118,7  <at>  <at>  if HAVE_CAIRO_FT
 if HAVE_CAIRO_PNG
 hb_view_SOURCES = hb-view.c
 hb_view_CPPFLAGS = $(HBCFLAGS) $(CAIRO_FT_CFLAGS) $(CAIRO_PNG_CFLAGS)
-hb_view_LDADD = libharfbuzz.la $(HBLIBS) $(CAIRO_FT_LIBS) $(CAIRO_PNG_LIBS)
+hb_view_LDADD = libharfbuzz.la -lm $(HBLIBS) $(CAIRO_FT_LIBS) $(CAIRO_PNG_LIBS)
 bin_PROGRAMS += hb-view
 endif
 endif
Behdad Esfahbod | 2 Mar 2011 05:24
Favicon
Gravatar

Re: hb-view

On 02/27/11 10:18, Khaled Hosny wrote:
> It is not usable for RTL currently (at least the ability to force
> direction even in absence of fribidi would to the job).

Forcing direction is the easy part.  We also need forcing script or
autodetecting it before Arabic would work.

Currently we don't have a way to parse a string into a hb_script_t.  I still
have an open design question re whether we should get away from a enum-based
hb_script_t and move to a ISO 15924 tag-based hb_script_t.  If we do that,
parsing from strings would be trivial.

A compromise would be a parsing string that handles the defined enum values,
and uses a tag for unknown values.  Something like:

hb_script_t
hb_script_from_string (const char *s)
{
  if (strcmp (s, "Arab"))
    return HB_SCRIPT_ARABIC;
  if (strcmp (s, "Latn"))
    return HB_SCRIPT_LATIN;
  ...

  return hb_tag_from_string (s);
}

> The ability to
> select font features (including switching off default ones) would be
> very handy for font testing and debugging.
(Continue reading)

Behdad Esfahbod | 2 Mar 2011 07:01

harfbuzz-ng: Branch 'master'

 src/hb-view.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit b7b29684df67af7280b74ca4cf18f02ad6521bdc
Author: Behdad Esfahbod <behdad@...>
Date:   Wed Mar 2 01:01:03 2011 -0500

    [hb-view] Handle write_to_png errors

diff --git a/src/hb-view.c b/src/hb-view.c
index dcb9571..5c0c48c 100644
--- a/src/hb-view.c
+++ b/src/hb-view.c
 <at>  <at>  -324,6 +324,8  <at>  <at>  draw (void)
 int
 main (int argc, char **argv)
 {
+  cairo_status_t status;
+
   parse_opts (argc, argv);

   FT_Init_FreeType (&ft_library);
 <at>  <at>  -336,7 +338,12  <at>  <at>  main (int argc, char **argv)
   draw ();
   draw ();

-  cairo_surface_write_to_png (surface, out_file);
+  status = cairo_surface_write_to_png (surface, out_file);
+  if (status != CAIRO_STATUS_SUCCESS) {
(Continue reading)

Behdad Esfahbod | 2 Mar 2011 07:01
Favicon
Gravatar

Re: harfbuzz-ng: Branch 'master'

On 02/26/11 12:57, Wouter Bolsterlee wrote:
> Hi Behdad,
> 
> Thanks for working on this. I've added a few comments below.

Thanks Wouter.  Comments inline.

>     — Wouter
> 
> Behdad Esfahbod schreef op di 22-02-2011 om 15:06 [-0800]:
>> commit 5353bf439c150492708ef9337078cfd73b83627b
> [snip]
>> +int
>> +main (int argc, char **argv)
>> +{
> [...]
>> +  cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
>> +
>> +  draw ();
>> +  draw ();
> 
> What is the reason to invoke draw() twice?

The code needs restructuring to not use global variables the way it currently
does.  But regardless, the first draw starts with a 0x0 surface, draw, and
computes the desired width and height, and the second draw creates a surface
with the desired width and height and does the same.  It's a common pattern
reoccurring with cairo drawing.

>> +  cairo_surface_write_to_png (surface, out_file);
(Continue reading)

Martin Hosken | 2 Mar 2011 10:43
Favicon

Re: hb-view

Dear Behdad,

> A compromise would be a parsing string that handles the defined enum values,
> and uses a tag for unknown values.  Something like:
> 
> hb_script_t
> hb_script_from_string (const char *s)
> {
>   if (strcmp (s, "Arab"))
>     return HB_SCRIPT_ARABIC;
>   if (strcmp (s, "Latn"))
>     return HB_SCRIPT_LATIN;
>   ...
> 
>   return hb_tag_from_string (s);
> }

+1

I like this approach. We need to get away from enums and into more open approaches, while maintaining
backward compatibility. Perhaps your hb_tag_from_string could work on an uppercased version of the
string, to allow the script tag to remain case independent. Hmm perhaps the whole function needs to be case independent.

Yours,
Martin
Jonathan Kew | 3 Mar 2011 23:39

Shaper for New Tai Lue

Hi Behdad,

In the interest of providing shaping for additional scripts, here is an attempt at "the simplest of all
complex-script shapers", to support New Tai Lue script.

This does not require any special feature support, so it's a lot simpler than the Arabic shaper; but on the
other hand it does need to do character-level reordering, and to support this I've introduced an
additional function hb_preprocess_chars() that is called before the character codes are mapped to
glyphs. Other scripts such as Hangul will also need to hook into the shaping process here, I think.

The patch here is based on the version of harfbuzz-ng code currently in the Mozilla tree; if any adjustment
is needed for your current code, it should be easy to deal with, I expect.

JK

Attachment (hb-newtailue): application/octet-stream, 9 KiB


Behdad Esfahbod | 4 Mar 2011 01:21
Favicon
Gravatar

Re: Shaper for New Tai Lue

Thanks Jonathan.

On 03/03/11 17:39, Jonathan Kew wrote:
> Hi Behdad,
> 
> In the interest of providing shaping for additional scripts, here is an attempt at "the simplest of all
complex-script shapers", to support New Tai Lue script.
> 
> This does not require any special feature support, so it's a lot simpler than the Arabic shaper; but on the
other hand it does need to do character-level reordering, and to support this I've introduced an
additional function hb_preprocess_chars() that is called before the character codes are mapped to
glyphs. Other scripts such as Hangul will also need to hook into the shaping process here, I think.
> 
> The patch here is based on the version of harfbuzz-ng code currently in the Mozilla tree; if any adjustment
is needed for your current code, it should be easy to deal with, I expect.
> 
> JK
> 
> 
> 
> 
> 
> 
Behdad Esfahbod | 16 Mar 2011 19:03

harfbuzz-ng: Branch 'master'

 src/hb-common.h          |    3 +-
 src/hb-icu.c             |    2 -
 src/hb-ot-shape.cc       |    3 +-
 src/hb-shape.cc          |   52 +++++++++++++++++++++++++++++++++++++++++------
 src/hb-unicode-private.h |    4 ---
 src/hb-unicode.c         |    2 -
 src/hb-unicode.h         |    8 ++++++-
 src/hb-view.c            |    4 +--
 8 files changed, 61 insertions(+), 17 deletions(-)

New commits:
commit 3286fc0e9adc3f2874c9409e7fdb09e4d2b7dda1
Author: Behdad Esfahbod <behdad@...>
Date:   Wed Mar 16 14:53:32 2011 -0300

    Let hb_shape() guess script and direction...

    - Rename HB_SCRIPT_INVALID_CODE to HB_SCRIPT_INVALID

    - Add HB_DIRECTION_INVALID

    - Make hb_script_get_horizontal_direction() public

    - Make hb_shape() guess script from buffer text (first non-common
      non-inherit script) if buffer script is set to HB_SCRIPT_INVALID (this
      is NOT the default.)

    - Make hb_shape() guess direction from buffer script if buffer direction
    is set to HB_DIRECTION_INVALID (this is NOT the default.)

(Continue reading)

Behdad Esfahbod | 16 Mar 2011 19:04
Favicon
Gravatar

Re: hb-view

On 02/27/11 12:18, Khaled Hosny wrote:
> It is not usable for RTL currently (at least the ability to force
> direction even in absence of fribidi would to the job).

I "fixed" that for now:

New commits:
commit 3286fc0e9adc3f2874c9409e7fdb09e4d2b7dda1
Author: Behdad Esfahbod <behdad@...>
Date:   Wed Mar 16 14:53:32 2011 -0300

    Let hb_shape() guess script and direction...

    - Rename HB_SCRIPT_INVALID_CODE to HB_SCRIPT_INVALID

    - Add HB_DIRECTION_INVALID

    - Make hb_script_get_horizontal_direction() public

    - Make hb_shape() guess script from buffer text (first non-common
      non-inherit script) if buffer script is set to HB_SCRIPT_INVALID (this
      is NOT the default.)

    - Make hb_shape() guess direction from buffer script if buffer direction
    is set to HB_DIRECTION_INVALID (this is NOT the default.)

    - Make hb-view.c set INVALID script and direction on the buffer.

    The above changes are meant to make hb-view fairly useful for uni-script
    uni-direction text.  The guessing behavior however is NOT the default of
(Continue reading)


Gmane