summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO19
-rw-r--r--include/fitz/path.h2
-rw-r--r--include/fitz/text.h1
-rw-r--r--mupdf/build.c15
-rw-r--r--mupdf/interpret.c4
-rw-r--r--tree/path.c2
-rw-r--r--tree/text.c34
7 files changed, 59 insertions, 18 deletions
diff --git a/TODO b/TODO
index d90fbf81..63dd9669 100644
--- a/TODO
+++ b/TODO
@@ -1,15 +1,20 @@
immediate plan:
- - global font/cmap cache
- - text fill + clip mode
- altivec optimize
- page labels + dests + outline + annots
- design gui for editor
- go through spec and check all features!
- - font and cmap config (where to load cmap and which cid fonts)
- talk to keithp about fontconfig cid-font + cmap support
+ - unify handling of mallocing fonts and images
+ - font and cmap config (where to load cmap and which cid fonts)
+ - global font/cmap cache
+ - split type3 and ftfont malloc (dont waste t3 charprocs on ft fonts)
+ - make ftfontfile separate struct w/ refcounting
+
---
+std rsrc fmt
+
transparency (v2)
- everything!
@@ -34,20 +39,14 @@ rendering
- font focus
parser
- - stick objects automatically into xref resource cache, not in preloadres
- try to clean up colorspace/material handling in interpreter
- annotations and destinations (for links and outline)
fz_optimizetree()
+ - error & memory
- concatenate chained transforms
- remove identity transforms
-clean up
- - reference count everything
- - design by contract
- - split into private and public
- - comments and documentation
-
cache
global cache for cmaps and fontfiles (emb+sys)
render cache (link-nodes and scaled images and shades)
diff --git a/include/fitz/path.h b/include/fitz/path.h
index f0a3d573..75b3060d 100644
--- a/include/fitz/path.h
+++ b/include/fitz/path.h
@@ -52,7 +52,7 @@ struct fz_pathnode_s
};
fz_error *fz_newpathnode(fz_pathnode **pathp);
-fz_error *fz_clonepath(fz_pathnode **pathp, fz_pathnode *oldpath);
+fz_error *fz_clonepathnode(fz_pathnode **pathp, fz_pathnode *oldpath);
fz_error *fz_moveto(fz_pathnode*, float x, float y);
fz_error *fz_lineto(fz_pathnode*, float x, float y);
fz_error *fz_curveto(fz_pathnode*, float, float, float, float, float, float);
diff --git a/include/fitz/text.h b/include/fitz/text.h
index 1a321f8f..8bb6ee5a 100644
--- a/include/fitz/text.h
+++ b/include/fitz/text.h
@@ -16,6 +16,7 @@ struct fz_textnode_s
};
fz_error *fz_newtextnode(fz_textnode **textp, fz_font *face);
+fz_error *fz_clonetextnode(fz_textnode **textp, fz_textnode *oldtext);
fz_error *fz_addtext(fz_textnode *text, int g, float x, float y);
fz_error *fz_endtext(fz_textnode *text);
diff --git a/mupdf/build.c b/mupdf/build.c
index 2010ca20..e9bb6d67 100644
--- a/mupdf/build.c
+++ b/mupdf/build.c
@@ -536,7 +536,7 @@ pdf_showpath(pdf_csi *csi,
if (dofill && dostroke)
{
fpath = csi->path;
- error = fz_clonepath(&spath, fpath);
+ error = fz_clonepathnode(&spath, fpath);
if (error) return error;
}
else
@@ -588,8 +588,6 @@ pdf_flushtext(pdf_csi *csi)
if (csi->text)
{
-
- /* invisible */
switch (csi->textmode)
{
case 0: /* fill */
@@ -609,6 +607,17 @@ pdf_flushtext(pdf_csi *csi)
case 4: /* fill + clip */
case 5: /* stroke + clip */
case 6: /* stroke + fill + clip */
+ {
+ fz_textnode *temp;
+ error = fz_clonetextnode(&temp, csi->text);
+ if (error)
+ return error;
+ error = pdf_addfillshape(gstate, (fz_node*)temp);
+ if (error)
+ return error;
+ }
+ /* fall through */
+
case 7: /* invisible clip */
if (!csi->textclip)
{
diff --git a/mupdf/interpret.c b/mupdf/interpret.c
index a2f23e13..6f43bc7f 100644
--- a/mupdf/interpret.c
+++ b/mupdf/interpret.c
@@ -387,7 +387,7 @@ runkeyword(pdf_csi *csi, pdf_xref *xref, fz_obj *rdb, char *buf)
{
if (csi->top != 0)
goto syntaxerror;
- error = fz_clonepath(&csi->clip, csi->path);
+ error = fz_clonepathnode(&csi->clip, csi->path);
if (error) return error;
error = fz_endpath(csi->clip, FZ_EOFILL, nil, nil);
if (error) return error;
@@ -953,7 +953,7 @@ fz_debugobj(rdb);
case 'W':
if (csi->top != 0)
goto syntaxerror;
- error = fz_clonepath(&csi->clip, csi->path);
+ error = fz_clonepathnode(&csi->clip, csi->path);
if (error) return error;
error = fz_endpath(csi->clip, FZ_FILL, nil, nil);
if (error) return error;
diff --git a/tree/path.c b/tree/path.c
index ac070025..b623d25c 100644
--- a/tree/path.c
+++ b/tree/path.c
@@ -25,7 +25,7 @@ fz_newpathnode(fz_pathnode **pathp)
}
fz_error *
-fz_clonepath(fz_pathnode **pathp, fz_pathnode *oldpath)
+fz_clonepathnode(fz_pathnode **pathp, fz_pathnode *oldpath)
{
fz_pathnode *path;
diff --git a/tree/text.c b/tree/text.c
index b94664b5..d88e04ec 100644
--- a/tree/text.c
+++ b/tree/text.c
@@ -5,7 +5,7 @@ fz_newtextnode(fz_textnode **textp, fz_font *font)
{
fz_textnode *text;
- text = *textp = fz_malloc(sizeof(fz_textnode));
+ text = fz_malloc(sizeof(fz_textnode));
if (!text)
return fz_outofmem;
@@ -17,6 +17,38 @@ fz_newtextnode(fz_textnode **textp, fz_font *font)
text->cap = 0;
text->els = nil;
+ *textp = text;
+ return nil;
+}
+
+fz_error *
+fz_clonetextnode(fz_textnode **textp, fz_textnode *oldtext)
+{
+ fz_textnode *text;
+
+ text = *textp = fz_malloc(sizeof(fz_textnode));
+ if (!text)
+ return fz_outofmem;
+
+ fz_initnode((fz_node*)text, FZ_NTEXT);
+
+ text->font = fz_keepfont(oldtext->font);
+ text->trm = oldtext->trm;
+ text->len = oldtext->len;
+ text->cap = oldtext->len;
+ text->els = nil;
+
+ text->els = fz_malloc(sizeof(fz_textel) * text->len);
+ if (!text->els)
+ {
+ fz_dropfont(text->font);
+ fz_free(text);
+ return fz_outofmem;
+ }
+
+ memcpy(text->els, oldtext->els, sizeof(fz_textel) * text->len);
+
+ *textp = text;
return nil;
}