summaryrefslogtreecommitdiff
path: root/pdf/pdf_build.c
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_build.c')
-rw-r--r--pdf/pdf_build.c432
1 files changed, 216 insertions, 216 deletions
diff --git a/pdf/pdf_build.c b/pdf/pdf_build.c
index 616f1c86..6908da1a 100644
--- a/pdf/pdf_build.c
+++ b/pdf/pdf_build.c
@@ -4,62 +4,62 @@
#define TILE
void
-pdf_initgstate(pdf_gstate *gs, fz_matrix ctm)
+pdf_init_gstate(pdf_gstate *gs, fz_matrix ctm)
{
gs->ctm = ctm;
- gs->clipdepth = 0;
-
- gs->strokestate.linewidth = 1;
- gs->strokestate.linecap = 0;
- gs->strokestate.linejoin = 0;
- gs->strokestate.miterlimit = 10;
- gs->strokestate.dashphase = 0;
- gs->strokestate.dashlen = 0;
- memset(gs->strokestate.dashlist, 0, sizeof(gs->strokestate.dashlist));
-
- gs->stroke.kind = PDF_MCOLOR;
- gs->stroke.colorspace = fz_keepcolorspace(fz_devicegray);
+ gs->clip_depth = 0;
+
+ gs->stroke_state.linewidth = 1;
+ gs->stroke_state.linecap = 0;
+ gs->stroke_state.linejoin = 0;
+ gs->stroke_state.miterlimit = 10;
+ gs->stroke_state.dash_phase = 0;
+ gs->stroke_state.dash_len = 0;
+ memset(gs->stroke_state.dash_list, 0, sizeof(gs->stroke_state.dash_list));
+
+ gs->stroke.kind = PDF_MAT_COLOR;
+ gs->stroke.colorspace = fz_keep_colorspace(fz_device_gray);
gs->stroke.v[0] = 0;
- gs->stroke.pattern = nil;
- gs->stroke.shade = nil;
+ gs->stroke.pattern = NULL;
+ gs->stroke.shade = NULL;
gs->stroke.alpha = 1;
- gs->fill.kind = PDF_MCOLOR;
- gs->fill.colorspace = fz_keepcolorspace(fz_devicegray);
+ gs->fill.kind = PDF_MAT_COLOR;
+ gs->fill.colorspace = fz_keep_colorspace(fz_device_gray);
gs->fill.v[0] = 0;
- gs->fill.pattern = nil;
- gs->fill.shade = nil;
+ gs->fill.pattern = NULL;
+ gs->fill.shade = NULL;
gs->fill.alpha = 1;
- gs->charspace = 0;
- gs->wordspace = 0;
+ gs->char_space = 0;
+ gs->word_space = 0;
gs->scale = 1;
gs->leading = 0;
- gs->font = nil;
+ gs->font = NULL;
gs->size = -1;
gs->render = 0;
gs->rise = 0;
- gs->blendmode = FZ_BNORMAL;
- gs->softmask = nil;
- gs->softmaskctm = fz_identity;
+ gs->blendmode = FZ_BLEND_NORMAL;
+ gs->softmask = NULL;
+ gs->softmask_ctm = fz_identity;
gs->luminosity = 0;
}
void
-pdf_setcolorspace(pdf_csi *csi, int what, fz_colorspace *colorspace)
+pdf_set_colorspace(pdf_csi *csi, int what, fz_colorspace *colorspace)
{
pdf_gstate *gs = csi->gstate + csi->gtop;
pdf_material *mat;
- pdf_flushtext(csi);
+ pdf_flush_text(csi);
- mat = what == PDF_MFILL ? &gs->fill : &gs->stroke;
+ mat = what == PDF_FILL ? &gs->fill : &gs->stroke;
- fz_dropcolorspace(mat->colorspace);
+ fz_drop_colorspace(mat->colorspace);
- mat->kind = PDF_MCOLOR;
- mat->colorspace = fz_keepcolorspace(colorspace);
+ mat->kind = PDF_MAT_COLOR;
+ mat->colorspace = fz_keep_colorspace(colorspace);
mat->v[0] = 0;
mat->v[1] = 0;
@@ -68,20 +68,20 @@ pdf_setcolorspace(pdf_csi *csi, int what, fz_colorspace *colorspace)
}
void
-pdf_setcolor(pdf_csi *csi, int what, float *v)
+pdf_set_color(pdf_csi *csi, int what, float *v)
{
pdf_gstate *gs = csi->gstate + csi->gtop;
pdf_material *mat;
int i;
- pdf_flushtext(csi);
+ pdf_flush_text(csi);
- mat = what == PDF_MFILL ? &gs->fill : &gs->stroke;
+ mat = what == PDF_FILL ? &gs->fill : &gs->stroke;
switch (mat->kind)
{
- case PDF_MPATTERN:
- case PDF_MCOLOR:
+ case PDF_MAT_PATTERN:
+ case PDF_MAT_COLOR:
if (!strcmp(mat->colorspace->name, "Lab"))
{
mat->v[0] = v[0] / 100;
@@ -97,62 +97,62 @@ pdf_setcolor(pdf_csi *csi, int what, float *v)
}
static void
-pdf_unsetpattern(pdf_csi *csi, int what)
+pdf_unset_pattern(pdf_csi *csi, int what)
{
pdf_gstate *gs = csi->gstate + csi->gtop;
pdf_material *mat;
- mat = what == PDF_MFILL ? &gs->fill : &gs->stroke;
- if (mat->kind == PDF_MPATTERN)
+ mat = what == PDF_FILL ? &gs->fill : &gs->stroke;
+ if (mat->kind == PDF_MAT_PATTERN)
{
if (mat->pattern)
- pdf_droppattern(mat->pattern);
- mat->pattern = nil;
- mat->kind = PDF_MCOLOR;
+ pdf_drop_pattern(mat->pattern);
+ mat->pattern = NULL;
+ mat->kind = PDF_MAT_COLOR;
}
}
void
-pdf_setpattern(pdf_csi *csi, int what, pdf_pattern *pat, float *v)
+pdf_set_pattern(pdf_csi *csi, int what, pdf_pattern *pat, float *v)
{
pdf_gstate *gs = csi->gstate + csi->gtop;
pdf_material *mat;
- pdf_flushtext(csi);
+ pdf_flush_text(csi);
- mat = what == PDF_MFILL ? &gs->fill : &gs->stroke;
+ mat = what == PDF_FILL ? &gs->fill : &gs->stroke;
if (mat->pattern)
- pdf_droppattern(mat->pattern);
+ pdf_drop_pattern(mat->pattern);
- mat->kind = PDF_MPATTERN;
+ mat->kind = PDF_MAT_PATTERN;
if (pat)
- mat->pattern = pdf_keeppattern(pat);
+ mat->pattern = pdf_keep_pattern(pat);
else
- mat->pattern = nil;
+ mat->pattern = NULL;
if (v)
- pdf_setcolor(csi, what, v);
+ pdf_set_color(csi, what, v);
}
void
-pdf_setshade(pdf_csi *csi, int what, fz_shade *shade)
+pdf_set_shade(pdf_csi *csi, int what, fz_shade *shade)
{
pdf_gstate *gs = csi->gstate + csi->gtop;
pdf_material *mat;
- pdf_flushtext(csi);
+ pdf_flush_text(csi);
- mat = what == PDF_MFILL ? &gs->fill : &gs->stroke;
+ mat = what == PDF_FILL ? &gs->fill : &gs->stroke;
if (mat->shade)
- fz_dropshade(mat->shade);
+ fz_drop_shade(mat->shade);
- mat->kind = PDF_MSHADE;
- mat->shade = fz_keepshade(shade);
+ mat->kind = PDF_MAT_SHADE;
+ mat->shade = fz_keep_shade(shade);
}
static void
-pdf_showpattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
+pdf_show_pattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
{
pdf_gstate *gstate;
fz_matrix ptm, invptm;
@@ -166,60 +166,60 @@ pdf_showpattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
if (pat->ismask)
{
- pdf_unsetpattern(csi, PDF_MFILL);
- pdf_unsetpattern(csi, PDF_MSTROKE);
- if (what == PDF_MFILL)
+ pdf_unset_pattern(csi, PDF_FILL);
+ pdf_unset_pattern(csi, PDF_STROKE);
+ if (what == PDF_FILL)
{
- pdf_dropmaterial(&gstate->stroke);
- pdf_keepmaterial(&gstate->fill);
+ pdf_drop_material(&gstate->stroke);
+ pdf_keep_material(&gstate->fill);
gstate->stroke = gstate->fill;
}
- if (what == PDF_MSTROKE)
+ if (what == PDF_STROKE)
{
- pdf_dropmaterial(&gstate->fill);
- pdf_keepmaterial(&gstate->stroke);
+ pdf_drop_material(&gstate->fill);
+ pdf_keep_material(&gstate->stroke);
gstate->fill = gstate->stroke;
}
}
else
{
// TODO: unset only the current fill/stroke or both?
- pdf_unsetpattern(csi, what);
+ pdf_unset_pattern(csi, what);
}
/* don't apply softmasks to objects in the pattern as well */
if (gstate->softmask)
{
- pdf_dropxobject(gstate->softmask);
- gstate->softmask = nil;
+ pdf_drop_xobject(gstate->softmask);
+ gstate->softmask = NULL;
}
- ptm = fz_concat(pat->matrix, csi->topctm);
- invptm = fz_invertmatrix(ptm);
+ ptm = fz_concat(pat->matrix, csi->top_ctm);
+ invptm = fz_invert_matrix(ptm);
/* patterns are painted using the ctm in effect at the beginning of the content stream */
/* get bbox of shape in pattern space for stamping */
- area = fz_transformrect(invptm, area);
+ area = fz_transform_rect(invptm, area);
x0 = floorf(area.x0 / pat->xstep);
y0 = floorf(area.y0 / pat->ystep);
x1 = ceilf(area.x1 / pat->xstep);
y1 = ceilf(area.y1 / pat->ystep);
- oldtopctm = csi->topctm;
+ oldtopctm = csi->top_ctm;
oldtop = csi->gtop;
#ifdef TILE
if ((x1 - x0) * (y1 - y0) > 0)
{
- csi->dev->begintile(csi->dev->user, area, pat->bbox, pat->xstep, pat->ystep, ptm);
+ csi->dev->begin_tile(csi->dev->user, area, pat->bbox, pat->xstep, pat->ystep, ptm);
gstate->ctm = ptm;
- csi->topctm = gstate->ctm;
- error = pdf_runcsibuffer(csi, pat->resources, pat->contents);
+ csi->top_ctm = gstate->ctm;
+ error = pdf_run_csi_buffer(csi, pat->resources, pat->contents);
if (error)
fz_catch(error, "cannot render pattern tile");
while (oldtop < csi->gtop)
pdf_grestore(csi);
- csi->dev->endtile(csi->dev->user);
+ csi->dev->end_tile(csi->dev->user);
}
#else
{
@@ -229,8 +229,8 @@ pdf_showpattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
for (x = x0; x < x1; x++)
{
gstate->ctm = fz_concat(fz_translate(x * pat->xstep, y * pat->ystep), ptm);
- csi->topctm = gstate->ctm;
- error = pdf_runcsibuffer(csi, pat->resources, pat->contents);
+ csi->top_ctm = gstate->ctm;
+ error = pdf_run_csi_buffer(csi, pat->resources, pat->contents);
while (oldtop < csi->gtop)
pdf_grestore(csi);
if (error)
@@ -244,13 +244,13 @@ pdf_showpattern(pdf_csi *csi, pdf_pattern *pat, fz_rect area, int what)
cleanup:
#endif
- csi->topctm = oldtopctm;
+ csi->top_ctm = oldtopctm;
pdf_grestore(csi);
}
static void
-pdf_begingroup(pdf_csi *csi, fz_rect bbox)
+pdf_begin_group(pdf_csi *csi, fz_rect bbox)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
fz_error error;
@@ -258,164 +258,164 @@ pdf_begingroup(pdf_csi *csi, fz_rect bbox)
if (gstate->softmask)
{
pdf_xobject *softmask = gstate->softmask;
- fz_rect bbox = fz_transformrect(gstate->ctm, softmask->bbox);
+ fz_rect bbox = fz_transform_rect(gstate->ctm, softmask->bbox);
- gstate->softmask = nil;
+ gstate->softmask = NULL;
- csi->dev->beginmask(csi->dev->user, bbox, gstate->luminosity,
- softmask->colorspace, gstate->softmaskbc);
- error = pdf_runxobject(csi, nil, softmask, fz_identity);
+ csi->dev->begin_mask(csi->dev->user, bbox, gstate->luminosity,
+ softmask->colorspace, gstate->softmask_bc);
+ error = pdf_run_xobject(csi, NULL, softmask, fz_identity);
if (error)
fz_catch(error, "cannot run softmask");
- csi->dev->endmask(csi->dev->user);
+ csi->dev->end_mask(csi->dev->user);
gstate->softmask = softmask;
}
- if (gstate->blendmode != FZ_BNORMAL)
- csi->dev->begingroup(csi->dev->user, bbox, 0, 0, gstate->blendmode, 1);
+ if (gstate->blendmode != FZ_BLEND_NORMAL)
+ csi->dev->begin_group(csi->dev->user, bbox, 0, 0, gstate->blendmode, 1);
}
static void
-pdf_endgroup(pdf_csi *csi)
+pdf_end_group(pdf_csi *csi)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
- if (gstate->blendmode != FZ_BNORMAL)
- csi->dev->endgroup(csi->dev->user);
+ if (gstate->blendmode != FZ_BLEND_NORMAL)
+ csi->dev->end_group(csi->dev->user);
if (gstate->softmask)
- csi->dev->popclip(csi->dev->user);
+ csi->dev->pop_clip(csi->dev->user);
}
void
-pdf_showshade(pdf_csi *csi, fz_shade *shd)
+pdf_show_shade(pdf_csi *csi, fz_shade *shd)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
fz_rect bbox;
- bbox = fz_boundshade(shd, gstate->ctm);
+ bbox = fz_bound_shade(shd, gstate->ctm);
- pdf_begingroup(csi, bbox);
+ pdf_begin_group(csi, bbox);
- csi->dev->fillshade(csi->dev->user, shd, gstate->ctm, gstate->fill.alpha);
+ csi->dev->fill_shade(csi->dev->user, shd, gstate->ctm, gstate->fill.alpha);
- pdf_endgroup(csi);
+ pdf_end_group(csi);
}
void
-pdf_showimage(pdf_csi *csi, fz_pixmap *image)
+pdf_show_image(pdf_csi *csi, fz_pixmap *image)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
fz_rect bbox;
- bbox = fz_transformrect(gstate->ctm, fz_unitrect);
+ bbox = fz_transform_rect(gstate->ctm, fz_unit_rect);
if (image->mask)
{
/* apply blend group even though we skip the softmask */
- if (gstate->blendmode != FZ_BNORMAL)
- csi->dev->begingroup(csi->dev->user, bbox, 0, 0, gstate->blendmode, 1);
- csi->dev->clipimagemask(csi->dev->user, image->mask, gstate->ctm);
+ if (gstate->blendmode != FZ_BLEND_NORMAL)
+ csi->dev->begin_group(csi->dev->user, bbox, 0, 0, gstate->blendmode, 1);
+ csi->dev->clip_image_mask(csi->dev->user, image->mask, gstate->ctm);
}
else
- pdf_begingroup(csi, bbox);
+ pdf_begin_group(csi, bbox);
if (!image->colorspace)
{
switch (gstate->fill.kind)
{
- case PDF_MNONE:
+ case PDF_MAT_NONE:
break;
- case PDF_MCOLOR:
- csi->dev->fillimagemask(csi->dev->user, image, gstate->ctm,
+ case PDF_MAT_COLOR:
+ csi->dev->fill_image_mask(csi->dev->user, image, gstate->ctm,
gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha);
break;
- case PDF_MPATTERN:
+ case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- csi->dev->clipimagemask(csi->dev->user, image, gstate->ctm);
- pdf_showpattern(csi, gstate->fill.pattern, bbox, PDF_MFILL);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_image_mask(csi->dev->user, image, gstate->ctm);
+ pdf_show_pattern(csi, gstate->fill.pattern, bbox, PDF_FILL);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
- case PDF_MSHADE:
+ case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- csi->dev->clipimagemask(csi->dev->user, image, gstate->ctm);
- csi->dev->fillshade(csi->dev->user, gstate->fill.shade, gstate->ctm, gstate->fill.alpha);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_image_mask(csi->dev->user, image, gstate->ctm);
+ csi->dev->fill_shade(csi->dev->user, gstate->fill.shade, gstate->ctm, gstate->fill.alpha);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
}
}
else
{
- csi->dev->fillimage(csi->dev->user, image, gstate->ctm, gstate->fill.alpha);
+ csi->dev->fill_image(csi->dev->user, image, gstate->ctm, gstate->fill.alpha);
}
if (image->mask)
{
- csi->dev->popclip(csi->dev->user);
- if (gstate->blendmode != FZ_BNORMAL)
- csi->dev->endgroup(csi->dev->user);
+ csi->dev->pop_clip(csi->dev->user);
+ if (gstate->blendmode != FZ_BLEND_NORMAL)
+ csi->dev->end_group(csi->dev->user);
}
else
- pdf_endgroup(csi);
+ pdf_end_group(csi);
}
void
-pdf_showpath(pdf_csi *csi, int doclose, int dofill, int dostroke, int evenodd)
+pdf_show_path(pdf_csi *csi, int doclose, int dofill, int dostroke, int even_odd)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
fz_path *path;
fz_rect bbox;
path = csi->path;
- csi->path = fz_newpath();
+ csi->path = fz_new_path();
if (doclose)
fz_closepath(path);
if (dostroke)
- bbox = fz_boundpath(path, &gstate->strokestate, gstate->ctm);
+ bbox = fz_bound_path(path, &gstate->stroke_state, gstate->ctm);
else
- bbox = fz_boundpath(path, nil, gstate->ctm);
+ bbox = fz_bound_path(path, NULL, gstate->ctm);
if (csi->clip)
{
- gstate->clipdepth++;
- csi->dev->clippath(csi->dev->user, path, evenodd, gstate->ctm);
+ gstate->clip_depth++;
+ csi->dev->clip_path(csi->dev->user, path, even_odd, gstate->ctm);
csi->clip = 0;
}
- pdf_begingroup(csi, bbox);
+ pdf_begin_group(csi, bbox);
if (dofill)
{
switch (gstate->fill.kind)
{
- case PDF_MNONE:
+ case PDF_MAT_NONE:
break;
- case PDF_MCOLOR:
- csi->dev->fillpath(csi->dev->user, path, evenodd, gstate->ctm,
+ case PDF_MAT_COLOR:
+ csi->dev->fill_path(csi->dev->user, path, even_odd, gstate->ctm,
gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha);
break;
- case PDF_MPATTERN:
+ case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- csi->dev->clippath(csi->dev->user, path, evenodd, gstate->ctm);
- pdf_showpattern(csi, gstate->fill.pattern, bbox, PDF_MFILL);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_path(csi->dev->user, path, even_odd, gstate->ctm);
+ pdf_show_pattern(csi, gstate->fill.pattern, bbox, PDF_FILL);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
- case PDF_MSHADE:
+ case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- csi->dev->clippath(csi->dev->user, path, evenodd, gstate->ctm);
- csi->dev->fillshade(csi->dev->user, gstate->fill.shade, csi->topctm, gstate->fill.alpha);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_path(csi->dev->user, path, even_odd, gstate->ctm);
+ csi->dev->fill_shade(csi->dev->user, gstate->fill.shade, csi->top_ctm, gstate->fill.alpha);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
}
@@ -425,38 +425,38 @@ pdf_showpath(pdf_csi *csi, int doclose, int dofill, int dostroke, int evenodd)
{
switch (gstate->stroke.kind)
{
- case PDF_MNONE:
+ case PDF_MAT_NONE:
break;
- case PDF_MCOLOR:
- csi->dev->strokepath(csi->dev->user, path, &gstate->strokestate, gstate->ctm,
+ case PDF_MAT_COLOR:
+ csi->dev->stroke_path(csi->dev->user, path, &gstate->stroke_state, gstate->ctm,
gstate->stroke.colorspace, gstate->stroke.v, gstate->stroke.alpha);
break;
- case PDF_MPATTERN:
+ case PDF_MAT_PATTERN:
if (gstate->stroke.pattern)
{
- csi->dev->clipstrokepath(csi->dev->user, path, &gstate->strokestate, gstate->ctm);
- pdf_showpattern(csi, gstate->stroke.pattern, bbox, PDF_MFILL);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_stroke_path(csi->dev->user, path, &gstate->stroke_state, gstate->ctm);
+ pdf_show_pattern(csi, gstate->stroke.pattern, bbox, PDF_FILL);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
- case PDF_MSHADE:
+ case PDF_MAT_SHADE:
if (gstate->stroke.shade)
{
- csi->dev->clipstrokepath(csi->dev->user, path, &gstate->strokestate, gstate->ctm);
- csi->dev->fillshade(csi->dev->user, gstate->stroke.shade, csi->topctm, gstate->stroke.alpha);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_stroke_path(csi->dev->user, path, &gstate->stroke_state, gstate->ctm);
+ csi->dev->fill_shade(csi->dev->user, gstate->stroke.shade, csi->top_ctm, gstate->stroke.alpha);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
}
}
- pdf_endgroup(csi);
+ pdf_end_group(csi);
- fz_freepath(path);
+ fz_free_path(path);
}
void
-pdf_flushtext(pdf_csi *csi)
+pdf_flush_text(pdf_csi *csi)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
fz_text *text;
@@ -469,10 +469,10 @@ pdf_flushtext(pdf_csi *csi)
if (!csi->text)
return;
text = csi->text;
- csi->text = nil;
+ csi->text = NULL;
dofill = dostroke = doclip = doinvisible = 0;
- switch (csi->textmode)
+ switch (csi->text_mode)
{
case 0: dofill = 1; break;
case 1: dostroke = 1; break;
@@ -484,18 +484,18 @@ pdf_flushtext(pdf_csi *csi)
case 7: doclip = 1; break;
}
- bbox = fz_boundtext(text, gstate->ctm);
+ bbox = fz_bound_text(text, gstate->ctm);
- pdf_begingroup(csi, bbox);
+ pdf_begin_group(csi, bbox);
if (doinvisible)
- csi->dev->ignoretext(csi->dev->user, text, gstate->ctm);
+ csi->dev->ignore_text(csi->dev->user, text, gstate->ctm);
if (doclip)
{
if (csi->accumulate < 2)
- gstate->clipdepth++;
- csi->dev->cliptext(csi->dev->user, text, gstate->ctm, csi->accumulate);
+ gstate->clip_depth++;
+ csi->dev->clip_text(csi->dev->user, text, gstate->ctm, csi->accumulate);
csi->accumulate = 2;
}
@@ -503,26 +503,26 @@ pdf_flushtext(pdf_csi *csi)
{
switch (gstate->fill.kind)
{
- case PDF_MNONE:
+ case PDF_MAT_NONE:
break;
- case PDF_MCOLOR:
- csi->dev->filltext(csi->dev->user, text, gstate->ctm,
+ case PDF_MAT_COLOR:
+ csi->dev->fill_text(csi->dev->user, text, gstate->ctm,
gstate->fill.colorspace, gstate->fill.v, gstate->fill.alpha);
break;
- case PDF_MPATTERN:
+ case PDF_MAT_PATTERN:
if (gstate->fill.pattern)
{
- csi->dev->cliptext(csi->dev->user, text, gstate->ctm, 0);
- pdf_showpattern(csi, gstate->fill.pattern, bbox, PDF_MFILL);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_text(csi->dev->user, text, gstate->ctm, 0);
+ pdf_show_pattern(csi, gstate->fill.pattern, bbox, PDF_FILL);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
- case PDF_MSHADE:
+ case PDF_MAT_SHADE:
if (gstate->fill.shade)
{
- csi->dev->cliptext(csi->dev->user, text, gstate->ctm, 0);
- csi->dev->fillshade(csi->dev->user, gstate->fill.shade, csi->topctm, gstate->fill.alpha);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_text(csi->dev->user, text, gstate->ctm, 0);
+ csi->dev->fill_shade(csi->dev->user, gstate->fill.shade, csi->top_ctm, gstate->fill.alpha);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
}
@@ -532,41 +532,41 @@ pdf_flushtext(pdf_csi *csi)
{
switch (gstate->stroke.kind)
{
- case PDF_MNONE:
+ case PDF_MAT_NONE:
break;
- case PDF_MCOLOR:
- csi->dev->stroketext(csi->dev->user, text, &gstate->strokestate, gstate->ctm,
+ case PDF_MAT_COLOR:
+ csi->dev->stroke_text(csi->dev->user, text, &gstate->stroke_state, gstate->ctm,
gstate->stroke.colorspace, gstate->stroke.v, gstate->stroke.alpha);
break;
- case PDF_MPATTERN:
+ case PDF_MAT_PATTERN:
if (gstate->stroke.pattern)
{
- csi->dev->clipstroketext(csi->dev->user, text, &gstate->strokestate, gstate->ctm);
- pdf_showpattern(csi, gstate->stroke.pattern, bbox, PDF_MFILL);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_stroke_text(csi->dev->user, text, &gstate->stroke_state, gstate->ctm);
+ pdf_show_pattern(csi, gstate->stroke.pattern, bbox, PDF_FILL);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
- case PDF_MSHADE:
+ case PDF_MAT_SHADE:
if (gstate->stroke.shade)
{
- csi->dev->clipstroketext(csi->dev->user, text, &gstate->strokestate, gstate->ctm);
- csi->dev->fillshade(csi->dev->user, gstate->stroke.shade, csi->topctm, gstate->stroke.alpha);
- csi->dev->popclip(csi->dev->user);
+ csi->dev->clip_stroke_text(csi->dev->user, text, &gstate->stroke_state, gstate->ctm);
+ csi->dev->fill_shade(csi->dev->user, gstate->stroke.shade, csi->top_ctm, gstate->stroke.alpha);
+ csi->dev->pop_clip(csi->dev->user);
}
break;
}
}
- pdf_endgroup(csi);
+ pdf_end_group(csi);
- fz_freetext(text);
+ fz_free_text(text);
}
static void
-pdf_showglyph(pdf_csi *csi, int cid)
+pdf_show_glyph(pdf_csi *csi, int cid)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
- pdf_fontdesc *fontdesc = gstate->font;
+ pdf_font_desc *fontdesc = gstate->font;
fz_matrix tsm, trm;
float w0, w1, tx, ty;
pdf_hmtx h;
@@ -584,11 +584,11 @@ pdf_showglyph(pdf_csi *csi, int cid)
tsm.f = gstate->rise;
ucslen = 0;
- if (fontdesc->tounicode)
- ucslen = pdf_lookupcmapfull(fontdesc->tounicode, cid, ucsbuf);
- if (ucslen == 0 && cid < fontdesc->ncidtoucs)
+ if (fontdesc->to_unicode)
+ ucslen = pdf_lookup_cmap_full(fontdesc->to_unicode, cid, ucsbuf);
+ if (ucslen == 0 && cid < fontdesc->cid_to_ucs_len)
{
- ucsbuf[0] = fontdesc->cidtoucs[cid];
+ ucsbuf[0] = fontdesc->cid_to_ucs[cid];
ucslen = 1;
}
if (ucslen == 0 || (ucslen == 1 && ucsbuf[0] == 0))
@@ -597,11 +597,11 @@ pdf_showglyph(pdf_csi *csi, int cid)
ucslen = 1;
}
- gid = pdf_fontcidtogid(fontdesc, cid);
+ gid = pdf_font_cid_to_gid(fontdesc, cid);
if (fontdesc->wmode == 1)
{
- v = pdf_getvmtx(fontdesc, cid);
+ v = pdf_get_vmtx(fontdesc, cid);
tsm.e -= v.x * gstate->size * 0.001f;
tsm.f -= v.y * gstate->size * 0.001f;
}
@@ -616,44 +616,44 @@ pdf_showglyph(pdf_csi *csi, int cid)
fabsf(trm.b - csi->text->trm.b) > FLT_EPSILON ||
fabsf(trm.c - csi->text->trm.c) > FLT_EPSILON ||
fabsf(trm.d - csi->text->trm.d) > FLT_EPSILON ||
- gstate->render != csi->textmode)
+ gstate->render != csi->text_mode)
{
- pdf_flushtext(csi);
+ pdf_flush_text(csi);
- csi->text = fz_newtext(fontdesc->font, trm, fontdesc->wmode);
+ csi->text = fz_new_text(fontdesc->font, trm, fontdesc->wmode);
csi->text->trm.e = 0;
csi->text->trm.f = 0;
- csi->textmode = gstate->render;
+ csi->text_mode = gstate->render;
}
/* add glyph to textobject */
- fz_addtext(csi->text, gid, ucsbuf[0], trm.e, trm.f);
+ fz_add_text(csi->text, gid, ucsbuf[0], trm.e, trm.f);
/* add filler glyphs for one-to-many unicode mapping */
for (i = 1; i < ucslen; i++)
- fz_addtext(csi->text, -1, ucsbuf[i], trm.e, trm.f);
+ fz_add_text(csi->text, -1, ucsbuf[i], trm.e, trm.f);
if (fontdesc->wmode == 0)
{
- h = pdf_gethmtx(fontdesc, cid);
+ h = pdf_get_hmtx(fontdesc, cid);
w0 = h.w * 0.001f;
- tx = (w0 * gstate->size + gstate->charspace) * gstate->scale;
+ tx = (w0 * gstate->size + gstate->char_space) * gstate->scale;
csi->tm = fz_concat(fz_translate(tx, 0), csi->tm);
}
if (fontdesc->wmode == 1)
{
w1 = v.w * 0.001f;
- ty = w1 * gstate->size + gstate->charspace;
+ ty = w1 * gstate->size + gstate->char_space;
csi->tm = fz_concat(fz_translate(0, ty), csi->tm);
}
}
void
-pdf_showspace(pdf_csi *csi, float tadj)
+pdf_show_space(pdf_csi *csi, float tadj)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
- pdf_fontdesc *fontdesc = gstate->font;
+ pdf_font_desc *fontdesc = gstate->font;
if (!fontdesc)
{
@@ -668,10 +668,10 @@ pdf_showspace(pdf_csi *csi, float tadj)
}
void
-pdf_showstring(pdf_csi *csi, unsigned char *buf, int len)
+pdf_show_string(pdf_csi *csi, unsigned char *buf, int len)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
- pdf_fontdesc *fontdesc = gstate->font;
+ pdf_font_desc *fontdesc = gstate->font;
unsigned char *end = buf + len;
int cpt, cid;
@@ -683,36 +683,36 @@ pdf_showstring(pdf_csi *csi, unsigned char *buf, int len)
while (buf < end)
{
- buf = pdf_decodecmap(fontdesc->encoding, buf, &cpt);
- cid = pdf_lookupcmap(fontdesc->encoding, cpt);
+ buf = pdf_decode_cmap(fontdesc->encoding, buf, &cpt);
+ cid = pdf_lookup_cmap(fontdesc->encoding, cpt);
if (cid >= 0)
- pdf_showglyph(csi, cid);
+ pdf_show_glyph(csi, cid);
else
fz_warn("cannot encode character with code point %#x", cpt);
if (cpt == 32)
- pdf_showspace(csi, gstate->wordspace);
+ pdf_show_space(csi, gstate->word_space);
}
}
void
-pdf_showtext(pdf_csi *csi, fz_obj *text)
+pdf_show_text(pdf_csi *csi, fz_obj *text)
{
pdf_gstate *gstate = csi->gstate + csi->gtop;
int i;
- if (fz_isarray(text))
+ if (fz_is_array(text))
{
- for (i = 0; i < fz_arraylen(text); i++)
+ for (i = 0; i < fz_array_len(text); i++)
{
- fz_obj *item = fz_arrayget(text, i);
- if (fz_isstring(item))
- pdf_showstring(csi, (unsigned char *)fz_tostrbuf(item), fz_tostrlen(item));
+ fz_obj *item = fz_array_get(text, i);
+ if (fz_is_string(item))
+ pdf_show_string(csi, (unsigned char *)fz_to_str_buf(item), fz_to_str_len(item));
else
- pdf_showspace(csi, - fz_toreal(item) * gstate->size * 0.001f);
+ pdf_show_space(csi, - fz_to_real(item) * gstate->size * 0.001f);
}
}
- else if (fz_isstring(text))
+ else if (fz_is_string(text))
{
- pdf_showstring(csi, (unsigned char *)fz_tostrbuf(text), fz_tostrlen(text));
+ pdf_show_string(csi, (unsigned char *)fz_to_str_buf(text), fz_to_str_len(text));
}
}