summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2020-09-19 17:41:03 +0300
committerOleg Oshmyan <chortos@inbox.lv>2020-09-19 17:51:11 +0300
commit014cbcc3801a498151c7559662d9ce85d41e4948 (patch)
tree28fa43bcf2021df68329983942f62752e8f676a3 /libass
parent9a0b7b4351ff504a530bd3d00241f4ee0a39832b (diff)
downloadlibass-014cbcc3801a498151c7559662d9ce85d41e4948.tar.bz2
libass-014cbcc3801a498151c7559662d9ce85d41e4948.tar.xz
Use bool and true/false assignments for GlyphInfo::skip
Diffstat (limited to 'libass')
-rw-r--r--libass/ass_render.c10
-rw-r--r--libass/ass_render.h3
-rw-r--r--libass/ass_shaper.c8
3 files changed, 11 insertions, 10 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index ffef117..100df2c 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -1566,7 +1566,7 @@ static void trim_whitespace(ASS_Renderer *render_priv)
i = ti->length - 1;
cur = ti->glyphs + i;
while (i && IS_WHITESPACE(cur)) {
- cur->skip++;
+ cur->skip = true;
cur = ti->glyphs + --i;
}
@@ -1574,7 +1574,7 @@ static void trim_whitespace(ASS_Renderer *render_priv)
i = 0;
cur = ti->glyphs;
while (i < ti->length && IS_WHITESPACE(cur)) {
- cur->skip++;
+ cur->skip = true;
cur = ti->glyphs + ++i;
}
@@ -1586,18 +1586,18 @@ static void trim_whitespace(ASS_Renderer *render_priv)
j = i - 1;
cur = ti->glyphs + j;
while (j && IS_WHITESPACE(cur)) {
- cur->skip++;
+ cur->skip = true;
cur = ti->glyphs + --j;
}
// A break itself can contain a whitespace, too
cur = ti->glyphs + i;
if (cur->symbol == ' ' || cur->symbol == '\n') {
- cur->skip++;
+ cur->skip = true;
// Mark whitespace after
j = i + 1;
cur = ti->glyphs + j;
while (j < ti->length && IS_WHITESPACE(cur)) {
- cur->skip++;
+ cur->skip = true;
cur = ti->glyphs + ++j;
}
i = j - 1;
diff --git a/libass/ass_render.h b/libass/ass_render.h
index 7bdf1e3..3cb0e1c 100644
--- a/libass/ass_render.h
+++ b/libass/ass_render.h
@@ -21,6 +21,7 @@
#define LIBASS_RENDER_H
#include <inttypes.h>
+#include <stdbool.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
@@ -122,7 +123,7 @@ typedef struct {
// GlyphInfo and TextInfo are used for text centering and word-wrapping operations
typedef struct glyph_info {
unsigned symbol;
- unsigned skip; // skip glyph when layouting text
+ bool skip; // skip glyph when layouting text
ASS_Font *font;
int face_index;
int glyph_index;
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index fc12974..77425a5 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -595,7 +595,7 @@ shape_harfbuzz_process_run(GlyphInfo *glyphs, hb_buffer_t *buf, int offset)
// if we have more than one glyph per cluster, allocate a new one
// and attach to the root glyph
- if (info->skip == 0) {
+ if (!info->skip) {
while (info->next)
info = info->next;
info->next = malloc(sizeof(GlyphInfo));
@@ -608,7 +608,7 @@ shape_harfbuzz_process_run(GlyphInfo *glyphs, hb_buffer_t *buf, int offset)
}
// set position and advance
- info->skip = 0;
+ info->skip = false;
info->glyph_index = glyph_info[j].codepoint;
info->offset.x = pos[j].x_offset * info->scale_x;
info->offset.y = -pos[j].y_offset * info->scale_y;
@@ -634,7 +634,7 @@ static void shape_harfbuzz(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len)
// Initialize: skip all glyphs, this is undone later as needed
for (i = 0; i < len; i++)
- glyphs[i].skip = 1;
+ glyphs[i].skip = true;
for (i = 0; i < len; i++) {
int offset = i;
@@ -883,7 +883,7 @@ static void ass_shaper_skip_characters(TextInfo *text_info)
|| glyphs[i].symbol == 0x00ad
|| glyphs[i].symbol == 0x034f) {
glyphs[i].symbol = 0;
- glyphs[i].skip++;
+ glyphs[i].skip = true;
}
}
}