src/Makefile.am                  |    1 
 src/hb-common.h                  |    1 
 src/hb-font-private.hh           |   11 ++-
 src/hb-font.cc                   |   21 ++++--
 src/hb-font.h                    |   12 ---
 src/hb-ft.cc                     |    4 -
 src/hb-open-type-private.hh      |   17 ++++-
 src/hb-ot-head-private.hh        |  128 +++++++++++++++++++++++++++++++++++++++
 src/hb-ot-layout-gdef-private.hh |    6 -
 src/hb-ot-layout-gpos-private.hh |   37 +++++------
 src/hb-ot-layout-gsub-private.hh |    2 
 src/hb-ot-layout-private.hh      |   20 +++---
 src/hb-ot-layout.cc              |   31 ++++-----
 src/hb-private.h                 |    4 -
 14 files changed, 219 insertions(+), 76 deletions(-)

New commits:
commit 0a4399ca228d244e646abdb3487da0f13b228889
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Wed May 19 15:45:06 2010 -0400

    Fix scale issues
    
    hb_font_set_scale() now sets the value to be used to represent a unit
    pixel.  For example, if rendering a 10px font with a 26.6 representation,
    you would set scale to (10 << 6).  For 10px in 16.16 you would set it to
    (10 << 16).  This space should be the same space that the get_glyph_metrics
    and get_kerning callbacks work in.

diff --git a/src/hb-common.h b/src/hb-common.h
index f64d6cc..594d358 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -67,7 +67,6 @@ typedef uint32_t hb_tag_t;
 
 typedef uint32_t hb_codepoint_t;
 typedef int32_t hb_position_t;
-typedef int32_t hb_16dot16_t;
 typedef uint32_t hb_mask_t;
 
 typedef void (*hb_destroy_func_t) (void *user_data);
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 7cc6327..a58701e 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -33,8 +33,6 @@
 
 #include "hb-ot-head-private.hh"
 
-#include "hb-ot-layout-private.hh"
-
 HB_BEGIN_DECLS
 
 /*
@@ -69,7 +67,7 @@ struct _hb_face_t {
   hb_blob_t *head_blob;
   const struct head *head_table;
 
-  hb_ot_layout_t ot_layout;
+  struct hb_ot_layout_t *ot_layout;
 };
 
 
@@ -80,8 +78,8 @@ struct _hb_face_t {
 struct _hb_font_t {
   hb_reference_count_t ref_count;
 
-  hb_16dot16_t x_scale;
-  hb_16dot16_t y_scale;
+  unsigned int x_scale;
+  unsigned int y_scale;
 
   unsigned int x_ppem;
   unsigned int y_ppem;
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 3feddfc..c5355f6 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -234,7 +234,7 @@ static hb_face_t _hb_face_nil = {
   NULL, /* head_blob */
   NULL, /* head_table */
 
-  {} /* ot_layout */
+  NULL  /* ot_layout */
 };
 
 
@@ -255,7 +255,7 @@ hb_face_create_for_tables (hb_get_table_func_t  get_table,
   face->destroy = destroy;
   face->user_data = user_data;
 
-  _hb_ot_layout_init (face);
+  face->ot_layout = _hb_ot_layout_new (face);
 
   return face;
 }
@@ -330,7 +330,7 @@ hb_face_create_for_data (hb_blob_t    *blob,
   face->head_blob = Sanitizer<head>::sanitize (hb_face_get_table (face, 
HB_OT_TAG_head));
   face->head_table = Sanitizer<head>::lock_instance (face->head_blob);
 
-  _hb_ot_layout_init (face);
+  face->ot_layout = _hb_ot_layout_new (face);
 
   return face;
 }
@@ -353,7 +353,7 @@ hb_face_destroy (hb_face_t *face)
 {
   HB_OBJECT_DO_DESTROY (face);
 
-  _hb_ot_layout_fini (face);
+  _hb_ot_layout_free (face->ot_layout);
 
   hb_blob_unlock (face->head_blob);
   hb_blob_destroy (face->head_blob);
@@ -458,8 +458,8 @@ hb_font_set_funcs (hb_font_t         *font,
 
 void
 hb_font_set_scale (hb_font_t *font,
-                  hb_16dot16_t x_scale,
-                  hb_16dot16_t y_scale)
+                  unsigned int x_scale,
+                  unsigned int y_scale)
 {
   if (HB_OBJECT_IS_INERT (font))
     return;
diff --git a/src/hb-font.h b/src/hb-font.h
index fee8ada..433d31a 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -177,18 +177,12 @@ hb_font_get_funcs (hb_font_t       *font);
 
 
 /*
- * XXX
- * should we decompose this to units_per_EM and font-size?
- * units_per_EM setting then can go into the face, or better,
- * read from the 'head' table.
- *
- * Then we either need size+shape like freetype does, or a full
- * matrix.
+ * We should add support for full matrices.
  */
 void
 hb_font_set_scale (hb_font_t *font,
-                  hb_16dot16_t x_scale,
-                  hb_16dot16_t y_scale);
+                  unsigned int x_scale,
+                  unsigned int y_scale);
 
 /*
  * A zero value means "no hinting in that direction"
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 5b911bc..fdd87bc 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -230,8 +230,8 @@ hb_ft_font_create (FT_Face           ft_face,
                     hb_ft_get_font_funcs (),
                     destroy, ft_face);
   hb_font_set_scale (font,
-                    ft_face->size->metrics.x_scale,
-                    ft_face->size->metrics.y_scale);
+                    ((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) 
ft_face->units_per_EM) >> 16,
+                    ((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) 
ft_face->units_per_EM) >> 16);
   hb_font_set_ppem (font,
                    ft_face->size->metrics.x_ppem,
                    ft_face->size->metrics.y_ppem);
diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index 63fbee7..4989363 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -95,7 +95,7 @@ struct CaretValueFormat1
   inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t 
glyph_id HB_UNUSED) const
   {
     /* TODO vertical */
-    return _hb_16dot16_mul_round (c->font->x_scale, coordinate);
+    return c->scale_x (coordinate);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
@@ -144,8 +144,8 @@ struct CaretValueFormat3
   inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t 
glyph_id HB_UNUSED) const
   {
     /* TODO vertical */
-    return _hb_16dot16_mul_round (c->font->x_scale, coordinate) +
-          ((this+deviceTable).get_delta (c->font->x_ppem) << 16);
+    return c->scale_x (coordinate) +
+          ((this+deviceTable).get_delta (c->font->x_ppem) * c->font->x_scale);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index 35673b8..81e18d4 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -93,18 +93,15 @@ struct ValueFormat : USHORT
                    hb_internal_glyph_position_t &glyph_pos) const
   {
     unsigned int x_ppem, y_ppem;
-    hb_16dot16_t x_scale, y_scale;
     unsigned int format = *this;
 
     if (!format) return;
 
-    x_scale = layout->font->x_scale;
-    y_scale = layout->font->y_scale;
     /* design units -> fractional pixel */
-    if (format & xPlacement) glyph_pos.x_offset  += _hb_16dot16_mul_round 
(x_scale, get_short (values++));
-    if (format & yPlacement) glyph_pos.y_offset  += _hb_16dot16_mul_round 
(y_scale, get_short (values++));
-    if (format & xAdvance)   glyph_pos.x_advance += _hb_16dot16_mul_round 
(x_scale, get_short (values++));
-    if (format & yAdvance)   glyph_pos.y_advance += _hb_16dot16_mul_round 
(y_scale, get_short (values++));
+    if (format & xPlacement) glyph_pos.x_offset  += layout->scale_x (get_short 
(values++));
+    if (format & yPlacement) glyph_pos.y_offset  += layout->scale_y (get_short 
(values++));
+    if (format & xAdvance)   glyph_pos.x_advance += layout->scale_x (get_short 
(values++));
+    if (format & yAdvance)   glyph_pos.y_advance += layout->scale_y (get_short 
(values++));
 
     if (!has_device ()) return;
 
@@ -115,16 +112,16 @@ struct ValueFormat : USHORT
 
     /* pixel -> fractional pixel */
     if (format & xPlaDevice) {
-      if (x_ppem) glyph_pos.x_offset  += (base + get_device 
(values++)).get_delta (x_ppem) << 16; else values++;
+      if (x_ppem) glyph_pos.x_offset  += (base + get_device 
(values++)).get_delta (x_ppem) * layout->font->x_scale; else values++;
     }
     if (format & yPlaDevice) {
-      if (y_ppem) glyph_pos.y_offset  += (base + get_device 
(values++)).get_delta (y_ppem) << 16; else values++;
+      if (y_ppem) glyph_pos.y_offset  += (base + get_device 
(values++)).get_delta (y_ppem) * layout->font->y_scale; else values++;
     }
     if (format & xAdvDevice) {
-      if (x_ppem) glyph_pos.x_advance += (base + get_device 
(values++)).get_delta (x_ppem) << 16; else values++;
+      if (x_ppem) glyph_pos.x_advance += (base + get_device 
(values++)).get_delta (x_ppem) * layout->font->x_scale; else values++;
     }
     if (format & yAdvDevice) {
-      if (y_ppem) glyph_pos.y_advance += (base + get_device 
(values++)).get_delta (y_ppem) << 16; else values++;
+      if (y_ppem) glyph_pos.y_advance += (base + get_device 
(values++)).get_delta (y_ppem) * layout->font->y_scale; else values++;
     }
   }
 
@@ -208,8 +205,8 @@ struct AnchorFormat1
   inline void get_anchor (hb_ot_layout_context_t *layout, hb_codepoint_t 
glyph_id HB_UNUSED,
                          hb_position_t *x, hb_position_t *y) const
   {
-      *x = _hb_16dot16_mul_round (layout->font->x_scale, xCoordinate);
-      *y = _hb_16dot16_mul_round (layout->font->y_scale, yCoordinate);
+      *x = layout->scale_x (xCoordinate);
+      *y = layout->scale_y (yCoordinate);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
@@ -240,8 +237,8 @@ struct AnchorFormat2
 
       if (x_ppem || y_ppem)
        ret = hb_font_get_contour_point (layout->font, layout->face, 
anchorPoint, glyph_id, &cx, &cy);
-      *x = x_ppem && ret ? cx : _hb_16dot16_mul_round (layout->font->x_scale, 
xCoordinate);
-      *y = y_ppem && ret ? cy : _hb_16dot16_mul_round (layout->font->y_scale, 
yCoordinate);
+      *x = x_ppem && ret ? cx : layout->scale_x (xCoordinate);
+      *y = y_ppem && ret ? cy : layout->scale_y (yCoordinate);
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
@@ -266,14 +263,14 @@ struct AnchorFormat3
   inline void get_anchor (hb_ot_layout_context_t *layout, hb_codepoint_t 
glyph_id HB_UNUSED,
                          hb_position_t *x, hb_position_t *y) const
   {
-      *x = _hb_16dot16_mul_round (layout->font->x_scale, xCoordinate);
-      *y = _hb_16dot16_mul_round (layout->font->y_scale, yCoordinate);
+      *x = layout->scale_x (xCoordinate);
+      *y = layout->scale_y (yCoordinate);
 
       /* pixel -> fractional pixel */
       if (layout->font->x_ppem)
-       *x += (this+xDeviceTable).get_delta (layout->font->x_ppem) << 16;
+       *x += (this+xDeviceTable).get_delta (layout->font->x_ppem) * 
layout->font->x_scale;
       if (layout->font->y_ppem)
-       *y += (this+yDeviceTable).get_delta (layout->font->y_ppem) << 16;
+       *y += (this+yDeviceTable).get_delta (layout->font->y_ppem) * 
layout->font->y_scale;
   }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
@@ -1615,7 +1612,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t 
*c)
 
 static inline bool position_lookup (hb_apply_context_t *c, unsigned int 
lookup_index)
 {
-  const GPOS &gpos = *(c->layout->face->ot_layout.gpos);
+  const GPOS &gpos = *(c->layout->face->ot_layout->gpos);
   const PosLookup &l = gpos.get_lookup (lookup_index);
 
   if (unlikely (c->nesting_level_left == 0))
diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh
index f8ad1f8..828c458 100644
--- a/src/hb-ot-layout-gsub-private.hh
+++ b/src/hb-ot-layout-gsub-private.hh
@@ -924,7 +924,7 @@ inline bool ExtensionSubst::is_reverse (void) const
 
 static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int 
lookup_index)
 {
-  const GSUB &gsub = *(c->layout->face->ot_layout.gsub);
+  const GSUB &gsub = *(c->layout->face->ot_layout->gsub);
   const SubstLookup &l = gsub.get_lookup (lookup_index);
 
   if (unlikely (c->nesting_level_left == 0))
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index e25f7ac..723db44 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -31,7 +31,7 @@
 
 #include "hb-ot-layout.h"
 
-#include "hb-font.h"
+#include "hb-font-private.hh"
 #include "hb-buffer-private.hh"
 
 
@@ -43,9 +43,7 @@ typedef unsigned int hb_ot_layout_class_t;
  * hb_ot_layout_t
  */
 
-typedef struct _hb_ot_layout_t hb_ot_layout_t;
-
-struct _hb_ot_layout_t
+struct hb_ot_layout_t
 {
   hb_blob_t *gdef_blob;
   hb_blob_t *gsub_blob;
@@ -62,8 +60,7 @@ struct _hb_ot_layout_t
   } new_gdef;
 };
 
-typedef struct _hb_ot_layout_context_t hb_ot_layout_context_t;
-struct _hb_ot_layout_context_t
+struct hb_ot_layout_context_t
 {
   hb_face_t *face;
   hb_font_t *font;
@@ -77,14 +74,19 @@ struct _hb_ot_layout_context_t
       hb_position_t anchor_y;   /* of the last valid glyph */
     } gpos;
   } info;
+
+  /* Convert from font-space to user-space */
+  /* XXX div-by-zero */
+  inline hb_position_t scale_x (int16_t v) { return (int64_t) 
this->font->x_scale * v / this->face->head_table->unitsPerEm; }
+  inline hb_position_t scale_y (int16_t v) { return (int64_t) 
this->font->y_scale * v / this->face->head_table->unitsPerEm; }
 };
 
 
-HB_INTERNAL void
-_hb_ot_layout_init (hb_face_t *face);
+HB_INTERNAL hb_ot_layout_t *
+_hb_ot_layout_new (hb_face_t *face);
 
 HB_INTERNAL void
-_hb_ot_layout_fini (hb_face_t *face);
+_hb_ot_layout_free (hb_ot_layout_t *layout);
 
 
 /*
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 3ee031c..82b56c8 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -39,12 +39,11 @@
 #include <string.h>
 
 
-void
-_hb_ot_layout_init (hb_face_t *face)
+hb_ot_layout_t *
+_hb_ot_layout_new (hb_face_t *face)
 {
-  hb_ot_layout_t *layout = &face->ot_layout;
-
-  memset (layout, 0, sizeof (*layout));
+  /* Remove this object altogether */
+  hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof 
(hb_ot_layout_t));
 
   layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_get_table (face, 
HB_OT_TAG_GDEF));
   layout->gdef = Sanitizer<GDEF>::lock_instance (layout->gdef_blob);
@@ -54,13 +53,13 @@ _hb_ot_layout_init (hb_face_t *face)
 
   layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_get_table (face, 
HB_OT_TAG_GPOS));
   layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob);
+
+  return layout;
 }
 
 void
-_hb_ot_layout_fini (hb_face_t *face)
+_hb_ot_layout_free (hb_ot_layout_t *layout)
 {
-  hb_ot_layout_t *layout = &face->ot_layout;
-
   hb_blob_unlock (layout->gdef_blob);
   hb_blob_unlock (layout->gsub_blob);
   hb_blob_unlock (layout->gpos_blob);
@@ -75,19 +74,19 @@ _hb_ot_layout_fini (hb_face_t *face)
 static const GDEF&
 _get_gdef (hb_face_t *face)
 {
-  return likely (face->ot_layout.gdef) ? *face->ot_layout.gdef : Null(GDEF);
+  return likely (face->ot_layout->gdef) ? *face->ot_layout->gdef : Null(GDEF);
 }
 
 static const GSUB&
 _get_gsub (hb_face_t *face)
 {
-  return likely (face->ot_layout.gsub) ? *face->ot_layout.gsub : Null(GSUB);
+  return likely (face->ot_layout->gsub) ? *face->ot_layout->gsub : Null(GSUB);
 }
 
 static const GPOS&
 _get_gpos (hb_face_t *face)
 {
-  return likely (face->ot_layout.gpos) ? *face->ot_layout.gpos : Null(GPOS);
+  return likely (face->ot_layout->gpos) ? *face->ot_layout->gpos : Null(GPOS);
 }
 
 
@@ -106,7 +105,7 @@ hb_ot_layout_has_glyph_classes (hb_face_t *face)
 hb_bool_t
 _hb_ot_layout_has_new_glyph_classes (hb_face_t *face)
 {
-  return face->ot_layout.new_gdef.len > 0;
+  return face->ot_layout->new_gdef.len > 0;
 }
 
 static unsigned int
@@ -118,8 +117,8 @@ _hb_ot_layout_get_glyph_property (hb_face_t      *face,
 
   klass = gdef.get_glyph_class (glyph);
 
-  if (!klass && glyph < face->ot_layout.new_gdef.len)
-    klass = face->ot_layout.new_gdef.klasses[glyph];
+  if (!klass && glyph < face->ot_layout->new_gdef.len)
+    klass = face->ot_layout->new_gdef.klasses[glyph];
 
   switch (klass) {
   default:
@@ -215,7 +214,7 @@ _hb_ot_layout_set_glyph_class (hb_face_t                  
*face,
 
   /* TODO optimize this? similar to old harfbuzz code for example */
 
-  hb_ot_layout_t *layout = &face->ot_layout;
+  hb_ot_layout_t *layout = face->ot_layout;
   hb_ot_layout_class_t gdef_klass;
   unsigned int len = layout->new_gdef.len;
 
@@ -288,7 +287,7 @@ hb_ot_layout_build_glyph_classes (hb_face_t      *face,
   if (HB_OBJECT_IS_INERT (face))
     return;
 
-  hb_ot_layout_t *layout = &face->ot_layout;
+  hb_ot_layout_t *layout = face->ot_layout;
 
   if (unlikely (!count || !glyphs || !klasses))
     return;
diff --git a/src/hb-private.h b/src/hb-private.h
index 6108d40..f017bf9 100644
--- a/src/hb-private.h
+++ b/src/hb-private.h
@@ -158,10 +158,6 @@ _hb_popcount32 (uint32_t mask)
 }
 
 
-/* Multiplies a 16dot16 value by another value, then truncates the result */
-#define _hb_16dot16_mul_round(A,B) (((int64_t) (A) * (B) + 0x8000) / 0x10000)
-
-
 /* We need external help for these */
 
 #ifdef HAVE_GLIB
commit cf5585cfa6cac6fdf627a99941299e76af5ae0f7
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Wed May 19 12:03:35 2010 -0400

    Add 'head' table

diff --git a/src/Makefile.am b/src/Makefile.am
index f52ea49..fb82f0e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,6 +20,7 @@ HBSOURCES =  \
        hb-open-file-private.hh \
        hb-open-type-private.hh \
        hb-language.c \
+       hb-ot-head-private.hh \
        hb-private.h \
        hb-shape.cc \
        hb-unicode.c \
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 0d82850..7cc6327 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -31,6 +31,8 @@
 
 #include "hb-font.h"
 
+#include "hb-ot-head-private.hh"
+
 #include "hb-ot-layout-private.hh"
 
 HB_BEGIN_DECLS
@@ -64,6 +66,9 @@ struct _hb_face_t {
   hb_destroy_func_t    destroy;
   void                *user_data;
 
+  hb_blob_t *head_blob;
+  const struct head *head_table;
+
   hb_ot_layout_t ot_layout;
 };
 
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 46b63a4..3feddfc 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -231,6 +231,9 @@ static hb_face_t _hb_face_nil = {
   NULL, /* destroy */
   NULL, /* user_data */
 
+  NULL, /* head_blob */
+  NULL, /* head_table */
+
   {} /* ot_layout */
 };
 
@@ -324,6 +327,9 @@ hb_face_create_for_data (hb_blob_t    *blob,
   face->user_data = _hb_face_for_data_closure_create 
(Sanitizer<OpenTypeFontFile>::sanitize (blob), index);
   hb_blob_destroy (blob);
 
+  face->head_blob = Sanitizer<head>::sanitize (hb_face_get_table (face, 
HB_OT_TAG_head));
+  face->head_table = Sanitizer<head>::lock_instance (face->head_blob);
+
   _hb_ot_layout_init (face);
 
   return face;
@@ -349,6 +355,9 @@ hb_face_destroy (hb_face_t *face)
 
   _hb_ot_layout_fini (face);
 
+  hb_blob_unlock (face->head_blob);
+  hb_blob_destroy (face->head_blob);
+
   if (face->destroy)
     face->destroy (face->user_data);
 
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 4fc82dd..2ab639c 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -120,7 +120,7 @@ inline Type& StructAfter(TObject &X)
  */
 
 /* Global nul-content Null pool.  Enlarge as necessary. */
-static const void *_NullPool[16 / sizeof (void *)];
+static const void *_NullPool[64 / sizeof (void *)];
 
 /* Generic nul-content Null objects. */
 template <typename Type>
diff --git a/src/hb-ot-head-private.hh b/src/hb-ot-head-private.hh
new file mode 100644
index 0000000..cdc981f
--- /dev/null
+++ b/src/hb-ot-head-private.hh
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2010  Red Hat, Inc.
+ *
+ *  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.
+ *
+ * Red Hat Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_HEAD_PRIVATE_HH
+#define HB_OT_HEAD_PRIVATE_HH
+
+#include "hb-open-type-private.hh"
+
+/*
+ * head
+ */
+
+#define HB_OT_TAG_head HB_TAG('h','e','a','d')
+
+struct head
+{
+  static const hb_tag_t Tag    = HB_OT_TAG_head;
+
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    /* Shall we check for magicNumber here?  Who cares? */
+    return c->check_struct (this) && likely (version.major == 1);
+  }
+
+  FixedVersion version;                /* Version of the head table--currently
+                                        * 0x00010000 for version 1.0. */
+  FixedVersion fontRevision;           /* Set by font manufacturer. */
+  ULONG                checkSumAdjustment;     /* To compute: set it to 0, sum 
the
+                                        * entire font as ULONG, then store
+                                        * 0xB1B0AFBA - sum. */
+  ULONG                magicNumber;            /* Set to 0x5F0F3CF5. */
+  USHORT       flags;                  /* Bit 0: Baseline for font at y=0;
+                                        * Bit 1: Left sidebearing point at x=0;
+                                        * Bit 2: Instructions may depend on 
point size;
+                                        * Bit 3: Force ppem to integer values 
for all
+                                        *   internal scaler math; may use 
fractional
+                                        *   ppem sizes if this bit is clear;
+                                        * Bit 4: Instructions may alter 
advance width
+                                        *   (the advance widths might not 
scale linearly);
+
+                                        * Bits 5-10: These should be set 
according to
+                                        *   Apple's specification. However, 
they are not
+                                        *   implemented in OpenType.
+                                        * Bit 5: This bit should be set in 
fonts that are
+                                        *   intended to e laid out vertically, 
and in
+                                        *   which the glyphs have been drawn 
such that an
+                                        *   x-coordinate of 0 corresponds to 
the desired
+                                        *   vertical baseline.
+                                        * Bit 6: This bit must be set to zero.
+                                        * Bit 7: This bit should be set if the 
font
+                                        *   requires layout for correct 
linguistic
+                                        *   rendering (e.g. Arabic fonts).
+                                        * Bit 8: This bit should be set for a 
GX font
+                                        *   which has one or more 
metamorphosis effects
+                                        *   designated as happening by default.
+                                        * Bit 9: This bit should be set if the 
font
+                                        *   contains any strong right-to-left 
glyphs.
+                                        * Bit 10: This bit should be set if 
the font
+                                        *   contains Indic-style rearrangement 
effects.
+
+                                        * Bit 11: Font data is 'lossless,' as 
a result
+                                        *   of having been compressed and 
decompressed
+                                        *   with the Agfa MicroType Express 
engine.
+                                        * Bit 12: Font converted (produce 
compatible metrics)
+                                        * Bit 13: Font optimized for 
ClearType™.
+                                        *   Note, fonts that rely on embedded 
bitmaps (EBDT)
+                                        *   for rendering should not be 
considered optimized
+                                        *   for ClearType, and therefore 
should keep this bit
+                                        *   cleared.
+                                        * Bit 14: Reserved, set to 0
+                                        * Bit 15: Reserved, set to 0. */
+  USHORT       unitsPerEm;             /* Valid range is from 16 to 16384. 
This value
+                                        * should be a power of 2 for fonts 
that have
+                                        * TrueType outlines. */
+  LONGDATETIME created;                /* Number of seconds since 12:00 
midnight,
+                                          January 1, 1904. 64-bit integer */
+  LONGDATETIME modified;               /* Number of seconds since 12:00 
midnight,
+                                          January 1, 1904. 64-bit integer */
+  SHORT                xMin;                   /* For all glyph bounding 
boxes. */
+  SHORT                yMin;                   /* For all glyph bounding 
boxes. */
+  SHORT                xMax;                   /* For all glyph bounding 
boxes. */
+  SHORT                yMax;                   /* For all glyph bounding 
boxes. */
+  USHORT       macStyle;               /* Bit 0: Bold (if set to 1);
+                                        * Bit 1: Italic (if set to 1)
+                                        * Bit 2: Underline (if set to 1)
+                                        * Bit 3: Outline (if set to 1)
+                                        * Bit 4: Shadow (if set to 1)
+                                        * Bit 5: Condensed (if set to 1)
+                                        * Bit 6: Extended (if set to 1)
+                                        * Bits 7-15: Reserved (set to 0). */
+  USHORT       lowestRecPPEM;          /* Smallest readable size in pixels. */
+  SHORT                fontDirectionHint;      /* Deprecated (Set to 2).
+                                        * 0: Fully mixed directional glyphs;
+                                        * 1: Only strongly left to right;
+                                        * 2: Like 1 but also contains neutrals;
+                                        * -1: Only strongly right to left;
+                                        * -2: Like -1 but also contains 
neutrals. */
+  SHORT                indexToLocFormat;       /* 0 for short offsets, 1 for 
long. */
+  SHORT                glyphDataFormat;        /* 0 for current format. */
+  public:
+  DEFINE_SIZE_STATIC (54);
+};
+
+
+#endif /* HB_OT_HEAD_PRIVATE_HH */
commit e29caf3f943b2b6f4997f469f7274252c82f465e
Author: Behdad Esfahbod <beh...@behdad.org>
Date:   Wed May 19 11:47:17 2010 -0400

    Add LONGDATETIME

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 16cc376..4fc82dd 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -406,6 +406,21 @@ typedef IntType<int16_t>  SHORT;   /* 16-bit signed 
integer. */
 typedef IntType<uint32_t> ULONG;       /* 32-bit unsigned integer. */
 typedef IntType<int32_t>  LONG;                /* 32-bit signed integer. */
 
+/* Date represented in number of seconds since 12:00 midnight, January 1,
+ * 1904. The value is represented as a signed 64-bit integer. */
+struct LONGDATETIME
+{
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE ();
+    return likely (c->check_struct (this));
+  }
+  private:
+  LONG major;
+  ULONG minor;
+  public:
+  DEFINE_SIZE_STATIC (8);
+};
+
 /* Array of four uint8s (length = 32 bits) used to identify a script, language
  * system, feature, or baseline */
 struct Tag : ULONG
_______________________________________________
HarfBuzz mailing list
HarfBuzz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to