Whitespace

This commit is contained in:
Behdad Esfahbod 2012-11-16 18:49:54 -08:00
parent 51bb498b7b
commit 7d52e6601f
17 changed files with 87 additions and 92 deletions

View File

@ -212,26 +212,22 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFDictionaryRef attrs = CFDictionaryCreate (kCFAllocatorDefault,
(const void**) &kCTFontAttributeName,
(const void**) &font_data->ct_font,
1, // count of attributes
1, /* count of attributes */
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
// TODO: support features
/* TODO: support features */
// Now we can create an attributed string
CFAttributedStringRef attr_string = CFAttributedStringCreate (kCFAllocatorDefault, string_ref, attrs);
CFRelease (string_ref);
CFRelease (attrs);
// Create the CoreText line from our string, then we're done with it
CTLineRef line = CTLineCreateWithAttributedString (attr_string);
CFRelease (attr_string);
// and finally retrieve the glyph data and store into the gfxTextRun
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
unsigned int num_runs = CFArrayGetCount (glyph_runs);
// Iterate through the glyph runs.
bool success = true;
buffer->len = 0;
@ -246,11 +242,9 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
buffer->ensure (buffer->len + num_glyphs);
// retrieve the laid-out glyph data from the CTRun
// Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds,
// and so copying data to our own buffer with CTRunGetGlyphs will be
// extremely rare.
/* Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds,
* and so copying data to our own buffer with CTRunGetGlyphs will be
* extremely rare. */
unsigned int scratch_size;
char *scratch = (char *) buffer->get_scratch_buffer (&scratch_size);
@ -294,7 +288,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
info->codepoint = glyphs[j];
info->cluster = string_indices[j];
// currently, we do all x-positioning by setting the advance, we never use x-offset
/* Currently, we do all x-positioning by setting the advance, we never use x-offset. */
info->mask = advance;
info->var1.u32 = 0;
info->var2.u32 = positions[j].y;
@ -316,12 +310,13 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
pos->y_offset = info->var2.u32;
}
// Fix up clusters so that we never return out-of-order indices;
// if core text has reordered glyphs, we'll merge them to the
// beginning of the reordered cluster.
// This does *not* mean we'll form the same clusters as Uniscribe
// or the native OT backend, only that the cluster indices will be
// non-decreasing in the output buffer.
/* Fix up clusters so that we never return out-of-order indices;
* if core text has reordered glyphs, we'll merge them to the
* beginning of the reordered cluster.
*
* This does *not* mean we'll form the same clusters as Uniscribe
* or the native OT backend, only that the cluster indices will be
* monotonic in the output buffer. */
if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) {
unsigned int prev_cluster = 0;
for (unsigned int i = 0; i < count; i++) {
@ -337,7 +332,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
prev_cluster = curr_cluster;
}
} else {
// For RTL runs, we make them non-increasing instead.
unsigned int prev_cluster = (unsigned int)-1;
for (unsigned int i = 0; i < count; i++) {
unsigned int curr_cluster = buffer->info[i].cluster;

View File

@ -115,7 +115,7 @@ _hb_icu_le_shape (hb_shape_plan_t *shape_plan,
LEFontInstance *font_instance = HB_SHAPER_DATA_GET (font);
le_int32 script_code = hb_icu_script_from_script (shape_plan->props.script);
le_int32 language_code = -1 /* TODO */;
le_int32 typography_flags = 3; // essential for ligatures and kerning
le_int32 typography_flags = 3; /* Needed for ligatures and kerning */
LEErrorCode status = LE_NO_ERROR;
le_engine *le = le_create ((const le_font *) font_instance,
script_code,

View File

@ -100,7 +100,7 @@ hb_old_convertStringToGlyphIndices (HB_Font old_font,
glyphs[i] = u;
}
*numGlyphs = length; // XXX
*numGlyphs = length; /* XXX */
return true;
}
@ -123,7 +123,7 @@ hb_old_canRender (HB_Font old_font,
const HB_UChar16 *string,
hb_uint32 length)
{
return true; // TODO
return true; /* TODO */
}
static HB_Error
@ -135,7 +135,7 @@ hb_old_getPointInOutline (HB_Font old_font,
HB_Fixed *ypos,
hb_uint32 *nPoints)
{
return HB_Err_Ok; // TODO
return HB_Err_Ok; /* TODO */
}
static void
@ -230,8 +230,8 @@ _hb_old_shaper_font_data_create (hb_font_t *font)
data->klass = &hb_old_font_class;
data->x_ppem = font->x_ppem;
data->y_ppem = font->y_ppem;
data->x_scale = font->x_scale; // XXX
data->y_scale = font->y_scale; // XXX
data->x_scale = font->x_scale; /* XXX */
data->y_scale = font->y_scale; /* XXX */
data->userData = font;
return data;

View File

@ -255,7 +255,7 @@ struct OpenTypeFontFile
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OPEN_FILE_PRIVATE_HH */

View File

@ -922,7 +922,7 @@ struct SortedArrayOf : ArrayOf<Type> {
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OPEN_TYPE_PRIVATE_HH */

View File

@ -143,7 +143,7 @@ struct head
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_HEAD_TABLE_HH */

View File

@ -91,7 +91,7 @@ struct hhea
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_HHEA_TABLE_HH */

View File

@ -86,7 +86,7 @@ struct hmtx
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_HMTX_TABLE_HH */

View File

@ -878,7 +878,7 @@ struct Device
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */

View File

@ -425,7 +425,7 @@ struct GDEF
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */

View File

@ -1712,7 +1712,7 @@ static inline bool position_lookup (hb_apply_context_t *c, unsigned int lookup_i
#undef cursive_chain
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_LAYOUT_GPOS_TABLE_HH */

View File

@ -1567,7 +1567,7 @@ static inline bool substitute_lookup (hb_apply_context_t *c, unsigned int lookup
}
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_LAYOUT_GSUB_TABLE_HH */

View File

@ -1820,7 +1820,7 @@ struct GSUBGPOS
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */

View File

@ -63,7 +63,7 @@ struct maxp
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_MAXP_TABLE_HH */

View File

@ -126,7 +126,7 @@ struct name
};
} // namespace OT
} /* namespace OT */
#endif /* HB_OT_NAME_TABLE_HH */

View File

@ -90,114 +90,115 @@ compose_default (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t *ab)
{
/* Hebrew presentation-form shaping.
* https://bugzilla.mozilla.org/show_bug.cgi?id=728866 */
// Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA;
// note that some letters do not have a dagesh presForm encoded
* https://bugzilla.mozilla.org/show_bug.cgi?id=728866
* Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA;
* Note that some letters do not have a dagesh presForm encoded.
*/
static const hb_codepoint_t sDageshForms[0x05EA - 0x05D0 + 1] = {
0xFB30, // ALEF
0xFB31, // BET
0xFB32, // GIMEL
0xFB33, // DALET
0xFB34, // HE
0xFB35, // VAV
0xFB36, // ZAYIN
0, // HET
0xFB38, // TET
0xFB39, // YOD
0xFB3A, // FINAL KAF
0xFB3B, // KAF
0xFB3C, // LAMED
0, // FINAL MEM
0xFB3E, // MEM
0, // FINAL NUN
0xFB40, // NUN
0xFB41, // SAMEKH
0, // AYIN
0xFB43, // FINAL PE
0xFB44, // PE
0, // FINAL TSADI
0xFB46, // TSADI
0xFB47, // QOF
0xFB48, // RESH
0xFB49, // SHIN
0xFB4A // TAV
0xFB30, /* ALEF */
0xFB31, /* BET */
0xFB32, /* GIMEL */
0xFB33, /* DALET */
0xFB34, /* HE */
0xFB35, /* VAV */
0xFB36, /* ZAYIN */
0x0000, /* HET */
0xFB38, /* TET */
0xFB39, /* YOD */
0xFB3A, /* FINAL KAF */
0xFB3B, /* KAF */
0xFB3C, /* LAMED */
0x0000, /* FINAL MEM */
0xFB3E, /* MEM */
0x0000, /* FINAL NUN */
0xFB40, /* NUN */
0xFB41, /* SAMEKH */
0x0000, /* AYIN */
0xFB43, /* FINAL PE */
0xFB44, /* PE */
0x0000, /* FINAL TSADI */
0xFB46, /* TSADI */
0xFB47, /* QOF */
0xFB48, /* RESH */
0xFB49, /* SHIN */
0xFB4A /* TAV */
};
bool found = c->unicode->compose (a, b, ab);
if (!found && (b & ~0x7F) == 0x0580) {
// special-case Hebrew presentation forms that are excluded from
// standard normalization, but wanted for old fonts
/* Special-case Hebrew presentation forms that are excluded from
* standard normalization, but wanted for old fonts. */
switch (b) {
case 0x05B4: // HIRIQ
if (a == 0x05D9) { // YOD
case 0x05B4: /* HIRIQ */
if (a == 0x05D9) { /* YOD */
*ab = 0xFB1D;
found = true;
}
break;
case 0x05B7: // patah
if (a == 0x05F2) { // YIDDISH YOD YOD
case 0x05B7: /* patah */
if (a == 0x05F2) { /* YIDDISH YOD YOD */
*ab = 0xFB1F;
found = true;
} else if (a == 0x05D0) { // ALEF
} else if (a == 0x05D0) { /* ALEF */
*ab = 0xFB2E;
found = true;
}
break;
case 0x05B8: // QAMATS
if (a == 0x05D0) { // ALEF
case 0x05B8: /* QAMATS */
if (a == 0x05D0) { /* ALEF */
*ab = 0xFB2F;
found = true;
}
break;
case 0x05B9: // HOLAM
if (a == 0x05D5) { // VAV
case 0x05B9: /* HOLAM */
if (a == 0x05D5) { /* VAV */
*ab = 0xFB4B;
found = true;
}
break;
case 0x05BC: // DAGESH
case 0x05BC: /* DAGESH */
if (a >= 0x05D0 && a <= 0x05EA) {
*ab = sDageshForms[a - 0x05D0];
found = (*ab != 0);
} else if (a == 0xFB2A) { // SHIN WITH SHIN DOT
} else if (a == 0xFB2A) { /* SHIN WITH SHIN DOT */
*ab = 0xFB2C;
found = true;
} else if (a == 0xFB2B) { // SHIN WITH SIN DOT
} else if (a == 0xFB2B) { /* SHIN WITH SIN DOT */
*ab = 0xFB2D;
found = true;
}
break;
case 0x05BF: // RAFE
case 0x05BF: /* RAFE */
switch (a) {
case 0x05D1: // BET
case 0x05D1: /* BET */
*ab = 0xFB4C;
found = true;
break;
case 0x05DB: // KAF
case 0x05DB: /* KAF */
*ab = 0xFB4D;
found = true;
break;
case 0x05E4: // PE
case 0x05E4: /* PE */
*ab = 0xFB4E;
found = true;
break;
}
break;
case 0x05C1: // SHIN DOT
if (a == 0x05E9) { // SHIN
case 0x05C1: /* SHIN DOT */
if (a == 0x05E9) { /* SHIN */
*ab = 0xFB2A;
found = true;
} else if (a == 0xFB49) { // SHIN WITH DAGESH
} else if (a == 0xFB49) { /* SHIN WITH DAGESH */
*ab = 0xFB2C;
found = true;
}
break;
case 0x05C2: // SIN DOT
if (a == 0x05E9) { // SHIN
case 0x05C2: /* SIN DOT */
if (a == 0x05E9) { /* SHIN */
*ab = 0xFB2B;
found = true;
} else if (a == 0xFB49) { // SHIN WITH DAGESH
} else if (a == 0xFB49) { /* SHIN WITH DAGESH */
*ab = 0xFB2D;
found = true;
}

View File

@ -68,7 +68,7 @@ _hb_tt_font_destroy (hb_tt_font_t *tt)
static inline const hhea&
_get_hhea (hb_face_t *face)
{
// return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea);
return likely (face->tt && face->tt->hhea) ? *face->tt->hhea : Null(hhea);
}