diff options
Diffstat (limited to 'fitz/res_text.c')
-rw-r--r-- | fitz/res_text.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/fitz/res_text.c b/fitz/res_text.c index 8ba62669..d38637f1 100644 --- a/fitz/res_text.c +++ b/fitz/res_text.c @@ -1,48 +1,48 @@ #include "fitz.h" fz_text * -fz_newtext(fz_font *font, fz_matrix trm, int wmode) +fz_new_text(fz_font *font, fz_matrix trm, int wmode) { fz_text *text; text = fz_malloc(sizeof(fz_text)); - text->font = fz_keepfont(font); + text->font = fz_keep_font(font); text->trm = trm; text->wmode = wmode; text->len = 0; text->cap = 0; - text->els = nil; + text->items = NULL; return text; } void -fz_freetext(fz_text *text) +fz_free_text(fz_text *text) { - fz_dropfont(text->font); - fz_free(text->els); + fz_drop_font(text->font); + fz_free(text->items); fz_free(text); } fz_text * -fz_clonetext(fz_text *old) +fz_clone_text(fz_text *old) { fz_text *text; text = fz_malloc(sizeof(fz_text)); - text->font = fz_keepfont(old->font); + text->font = fz_keep_font(old->font); text->trm = old->trm; text->wmode = old->wmode; text->len = old->len; text->cap = text->len; - text->els = fz_calloc(text->len, sizeof(fz_textel)); - memcpy(text->els, old->els, text->len * sizeof(fz_textel)); + text->items = fz_calloc(text->len, sizeof(fz_text_item)); + memcpy(text->items, old->items, text->len * sizeof(fz_text_item)); return text; } fz_rect -fz_boundtext(fz_text *text, fz_matrix ctm) +fz_bound_text(fz_text *text, fz_matrix ctm) { fz_matrix trm; fz_rect bbox; @@ -50,22 +50,22 @@ fz_boundtext(fz_text *text, fz_matrix ctm) int i; if (text->len == 0) - return fz_emptyrect; + return fz_empty_rect; /* find bbox of glyph origins in ctm space */ - bbox.x0 = bbox.x1 = text->els[0].x; - bbox.y0 = bbox.y1 = text->els[0].y; + bbox.x0 = bbox.x1 = text->items[0].x; + bbox.y0 = bbox.y1 = text->items[0].y; for (i = 1; i < text->len; i++) { - bbox.x0 = MIN(bbox.x0, text->els[i].x); - bbox.y0 = MIN(bbox.y0, text->els[i].y); - bbox.x1 = MAX(bbox.x1, text->els[i].x); - bbox.y1 = MAX(bbox.y1, text->els[i].y); + bbox.x0 = MIN(bbox.x0, text->items[i].x); + bbox.y0 = MIN(bbox.y0, text->items[i].y); + bbox.x1 = MAX(bbox.x1, text->items[i].x); + bbox.y1 = MAX(bbox.y1, text->items[i].y); } - bbox = fz_transformrect(ctm, bbox); + bbox = fz_transform_rect(ctm, bbox); /* find bbox of font in trm * ctm space */ @@ -78,7 +78,7 @@ fz_boundtext(fz_text *text, fz_matrix ctm) fbox.x1 = text->font->bbox.x1 * 0.001f; fbox.y1 = text->font->bbox.y1 * 0.001f; - fbox = fz_transformrect(trm, fbox); + fbox = fz_transform_rect(trm, fbox); /* expand glyph origin bbox by font bbox */ @@ -91,23 +91,23 @@ fz_boundtext(fz_text *text, fz_matrix ctm) } static void -fz_growtext(fz_text *text, int n) +fz_grow_text(fz_text *text, int n) { if (text->len + n < text->cap) return; while (text->len + n > text->cap) text->cap = text->cap + 36; - text->els = fz_realloc(text->els, text->cap, sizeof(fz_textel)); + text->items = fz_realloc(text->items, text->cap, sizeof(fz_text_item)); } void -fz_addtext(fz_text *text, int gid, int ucs, float x, float y) +fz_add_text(fz_text *text, int gid, int ucs, float x, float y) { - fz_growtext(text, 1); - text->els[text->len].ucs = ucs; - text->els[text->len].gid = gid; - text->els[text->len].x = x; - text->els[text->len].y = y; + fz_grow_text(text, 1); + text->items[text->len].ucs = ucs; + text->items[text->len].gid = gid; + text->items[text->len].x = x; + text->items[text->len].y = y; text->len++; } @@ -116,18 +116,18 @@ static int isxmlmeta(int c) return c < 32 || c >= 128 || c == '&' || c == '<' || c == '>' || c == '\'' || c == '"'; } -void fz_debugtext(fz_text *text, int indent) +void fz_debug_text(fz_text *text, int indent) { int i, n; for (i = 0; i < text->len; i++) { for (n = 0; n < indent; n++) putchar(' '); - if (!isxmlmeta(text->els[i].ucs)) + if (!isxmlmeta(text->items[i].ucs)) printf("<g ucs=\"%c\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", - text->els[i].ucs, text->els[i].gid, text->els[i].x, text->els[i].y); + text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y); else printf("<g ucs=\"U+%04X\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n", - text->els[i].ucs, text->els[i].gid, text->els[i].x, text->els[i].y); + text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y); } } |