[dwrite] Provide an experimental API for justification (#279)
This commit is contained in:
parent
4cd0cd6791
commit
1e1825bf47
|
@ -209,8 +209,8 @@ _hb_directwrite_shaper_face_data_destroy(hb_directwrite_shaper_face_data_t *data
|
||||||
data->fontFile->Release ();
|
data->fontFile->Release ();
|
||||||
if (data->dwriteFactory) {
|
if (data->dwriteFactory) {
|
||||||
if (data->fontFileLoader)
|
if (data->fontFileLoader)
|
||||||
data->dwriteFactory->UnregisterFontFileLoader(data->fontFileLoader);
|
data->dwriteFactory->UnregisterFontFileLoader (data->fontFileLoader);
|
||||||
data->dwriteFactory->Release();
|
data->dwriteFactory->Release ();
|
||||||
}
|
}
|
||||||
if (data->fontFileLoader)
|
if (data->fontFileLoader)
|
||||||
delete data->fontFileLoader;
|
delete data->fontFileLoader;
|
||||||
|
@ -542,12 +542,13 @@ static inline uint32_t hb_uint32_swap (const uint32_t v)
|
||||||
* shaper
|
* shaper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hb_bool_t
|
static hb_bool_t
|
||||||
_hb_directwrite_shape(hb_shape_plan_t *shape_plan,
|
_hb_directwrite_shape_full(hb_shape_plan_t *shape_plan,
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_t *buffer,
|
hb_buffer_t *buffer,
|
||||||
const hb_feature_t *features,
|
const hb_feature_t *features,
|
||||||
unsigned int num_features)
|
unsigned int num_features,
|
||||||
|
float lineWidth)
|
||||||
{
|
{
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
hb_directwrite_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
|
hb_directwrite_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
|
||||||
|
@ -728,9 +729,6 @@ retry_getglyphs:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: get lineWith from somewhere
|
|
||||||
float lineWidth = 0;
|
|
||||||
|
|
||||||
IDWriteTextAnalyzer1* analyzer1;
|
IDWriteTextAnalyzer1* analyzer1;
|
||||||
analyzer->QueryInterface (&analyzer1);
|
analyzer->QueryInterface (&analyzer1);
|
||||||
|
|
||||||
|
@ -900,3 +898,37 @@ retry_getglyphs:
|
||||||
/* Wow, done! */
|
/* Wow, done! */
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
_hb_directwrite_shape(hb_shape_plan_t *shape_plan,
|
||||||
|
hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer,
|
||||||
|
const hb_feature_t *features,
|
||||||
|
unsigned int num_features)
|
||||||
|
{
|
||||||
|
return _hb_directwrite_shape_full(shape_plan, font, buffer,
|
||||||
|
features, num_features, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Public [experimental] API
|
||||||
|
*/
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_shape_dwrite_experimental_width(hb_font_t *font,
|
||||||
|
hb_buffer_t *buffer,
|
||||||
|
const hb_feature_t *features,
|
||||||
|
unsigned int num_features,
|
||||||
|
float width)
|
||||||
|
{
|
||||||
|
static char *shapers = "directwrite";
|
||||||
|
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face,
|
||||||
|
&buffer->props, features, num_features, &shapers);
|
||||||
|
hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,
|
||||||
|
features, num_features, width);
|
||||||
|
|
||||||
|
if (res)
|
||||||
|
buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
|
|
||||||
HB_BEGIN_DECLS
|
HB_BEGIN_DECLS
|
||||||
|
|
||||||
|
HB_EXTERN hb_bool_t
|
||||||
|
hb_shape_dwrite_experimental_width(hb_font_t *font, hb_buffer_t *buffer,
|
||||||
|
const hb_feature_t *features, unsigned int num_features, float width);
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
||||||
#endif /* HB_DIRECTWRITE_H */
|
#endif /* HB_DIRECTWRITE_H */
|
||||||
|
|
Loading…
Reference in New Issue