| version 1.4, 2002/12/19 00:16:44 |
version 1.5, 2002/12/23 02:40:05 |
|
|
| #include "parse.h" |
#include "parse.h" |
| #include "cpdf.h" |
#include "cpdf.h" |
| #include "svga.h" |
#include "svga.h" |
| |
#include "utils.h" |
| #include "filter.h" |
#include "filter.h" |
| |
|
| void text(char *start,char *end) |
void text(char *start, char *end) |
| { |
{ |
| char *tj; |
char *tj; |
| int x = 10,y = 10; |
int x = 10, y = 10, len = end - start; |
| tj = strstr(start,"TJ") - 1; |
tj = strnstr(start, "TJ", len) - 1; |
| if(*tj == ']') |
while (*tj != '[') |
| while(*tj != '[') tj--; |
tj--; |
| while(tj != start) { |
while (tj != end) { |
| if(*tj == '(') |
if (*tj == '(') |
| for(tj++; *tj != ')';tj++) { |
for (tj++; *tj != ')'; tj++) { |
| gl_writen(x,y,sizeof(char),tj); |
gl_writen(x, y, sizeof(char), tj); |
| x += 10; |
x += 10; |
| if(x == screen.x - 10) { |
if (x == screen.x - 10) { |
| x = 10; |
x = 10; |
| y += 10; |
y += 10; |
| } |
} |
| if(y == screen.y - 10) |
if (y == screen.y - 10) |
| y = 10; |
y = 10; |
| } |
} |
| tj++; |
tj++; |
| } |
} |
| return; |
return; |
| } |
} |
| |
|
| void render(void) |
void render(void) |
| { |
{ |
| char *content,*txtstart,*txtend; |
char *content, *txtstart, *txtend; |
| |
unsigned long dstlen; |
| struct page *page; |
struct page *page; |
| page = (struct page *) get_object(page_tree[current_page],NULL); |
page = (struct page *) get_object(page_tree[current_page], NULL); |
| txtstart = content = (char *) calloc(100000,1); |
dstlen = 3 * page->contents->length; |
| |
txtstart = content = (char *) xcalloc((int) dstlen, 1); |
| #ifndef DEBUG |
#ifndef DEBUG |
| gl_setfont(8, 8, gl_font8x8); |
gl_setfont(8, 8, gl_font8x8); |
| gl_setwritemode(FONT_COMPRESSED + WRITEMODE_OVERWRITE); |
gl_setwritemode(FONT_COMPRESSED + WRITEMODE_OVERWRITE); |
| gl_setfontcolors(0xFFFFFFFF, 0); |
gl_setfontcolors(0xFFFFFFFF, 0); |
| #endif |
#endif |
| filter(page->contents->filter,page->contents->stream, |
filter(page->contents->filter, page->contents->stream, |
| page->contents->length,content,100000); |
page->contents->length, content, &dstlen); |
| write(2,content,1500); |
content = (char *) realloc(content, dstlen); |
| for(txtend = content;txtend != content + 1500; txtend++) |
write(2, content, (int) dstlen); |
| if(*txtend == '\0') |
while ((txtstart = strnstr(txtstart + 1, "BT", dstlen)) != NULL) { |
| *txtend = 'A'; |
txtend = strnstr(txtstart, "ET", dstlen); |
| while((txtstart = strstr(txtstart + 1,"BT")) != NULL) { |
text(txtstart, txtend); |
| txtend = strstr(txtstart,"ET"); |
|
| text(txtstart,txtend); |
|
| txtstart = txtend; |
txtstart = txtend; |
| } |
} |
| #ifndef DEBUG |
#ifndef DEBUG |