Skip to content

Commit

Permalink
Convert the harfbuzz shaper to C89
Browse files Browse the repository at this point in the history
  • Loading branch information
tgoyne authored and Thomas Goyne committed Jul 3, 2013
1 parent 6165aef commit c40afaf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libass/ass_shaper.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define MAX_RUNS 50

#ifdef CONFIG_HARFBUZZ
#include <hb-ft.h>
#include <harfbuzz/hb-ft.h>
enum {
VERT = 0,
VKNA,
Expand Down Expand Up @@ -352,25 +352,27 @@ static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info)
{
ASS_Font *font = info->font;
hb_font_t **hb_fonts;
struct ass_shaper_metrics_data *metrics;

if (!font->shaper_priv)
font->shaper_priv = calloc(sizeof(ASS_ShaperFontData), 1);


hb_fonts = font->shaper_priv->fonts;
if (!hb_fonts[info->face_index]) {
hb_font_funcs_t *funcs;

hb_fonts[info->face_index] =
hb_ft_font_create(font->faces[info->face_index], NULL);

// set up cached metrics access
font->shaper_priv->metrics_data[info->face_index] =
calloc(sizeof(struct ass_shaper_metrics_data), 1);
struct ass_shaper_metrics_data *metrics =
font->shaper_priv->metrics_data[info->face_index];
metrics = font->shaper_priv->metrics_data[info->face_index];
metrics->metrics_cache = shaper->metrics_cache;
metrics->vertical = info->font->desc.vertical;

hb_font_funcs_t *funcs = hb_font_funcs_create();
funcs = hb_font_funcs_create();
font->shaper_priv->font_funcs[info->face_index] = funcs;
hb_font_funcs_set_glyph_func(funcs, get_glyph,
metrics, NULL);
Expand Down Expand Up @@ -400,8 +402,7 @@ static hb_font_t *get_hb_font(ASS_Shaper *shaper, GlyphInfo *info)
update_hb_size(hb_fonts[info->face_index], font->faces[info->face_index]);

// update hash key for cached metrics
struct ass_shaper_metrics_data *metrics =
font->shaper_priv->metrics_data[info->face_index];
metrics = font->shaper_priv->metrics_data[info->face_index];
metrics->hash_key.font = info->font;
metrics->hash_key.face_index = info->face_index;
metrics->hash_key.size = info->font_size;
Expand Down

0 comments on commit c40afaf

Please sign in to comment.