Skip to content

Commit

Permalink
ass_shaper: use ass_codepoint_is_fullwidth
Browse files Browse the repository at this point in the history
  • Loading branch information
rcombs committed Aug 6, 2023
1 parent cca515d commit e663b4e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions libass/ass_font.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ typedef struct ass_font ASS_Font;
#include "ass_cache.h"
#include "ass_outline.h"

#define VERTICAL_LOWER_BOUND 0x02f1

#define ASS_FONT_MAX_FACES 10
#define DECO_UNDERLINE 1
#define DECO_STRIKETHROUGH 2
Expand Down
2 changes: 0 additions & 2 deletions libass/ass_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -2177,8 +2177,6 @@ static bool parse_events(RenderContext *state, ASS_Event *event)
info->bold = state->bold;
info->italic = state->italic;
info->flags = state->flags;
if (info->font->desc.vertical && code >= VERTICAL_LOWER_BOUND)
info->flags |= DECO_ROTATE;
info->frx = state->frx;
info->fry = state->fry;
info->frz = state->frz;
Expand Down
6 changes: 5 additions & 1 deletion libass/ass_shaper.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ get_cached_metrics(struct ass_shaper_metrics_data *metrics,
bool rotate = false;
// if @font rendering is enabled and the glyph should be rotated,
// make cached_h_advance pick up the right advance later
if (metrics->vertical && unicode >= VERTICAL_LOWER_BOUND)
if (metrics->vertical && ass_codepoint_is_fullwidth(metrics->hash_key.font->faces_cp[metrics->hash_key.face_index], unicode))
rotate = true;

metrics->hash_key.glyph_index = glyph;
Expand Down Expand Up @@ -894,6 +894,10 @@ void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv,
// get font face and glyph index
ass_font_get_index(render_priv->fontselect, info->font,
info->symbol, &info->face_index, &info->glyph_index);

if (info->font->desc.vertical &&
ass_codepoint_is_fullwidth(info->font->faces_cp[info->face_index], info->symbol))
info->flags |= DECO_ROTATE;
}
if (i > 0) {
GlyphInfo *last = glyphs + i - 1;
Expand Down

0 comments on commit e663b4e

Please sign in to comment.