X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Ftext.c;h=4bdcdaf087b109cf35aab54e76e8f5dc34ef5099;hb=bf04757cd94e94c1f67fa3d2a4e3e59fa5bce0c0;hp=87b786c97399994d686d681aaf9985c032f87ceb;hpb=ceb2b1f3c127005080fad32d29b0d27ac4a7b060;p=swftools.git diff --git a/lib/devices/text.c b/lib/devices/text.c index 87b786c..4bdcdaf 100644 --- a/lib/devices/text.c +++ b/lib/devices/text.c @@ -60,7 +60,7 @@ void text_startpage(gfxdevice_t*dev, int width, int height) i->current_page = i->current_page->next; } i->current_page->textsize = 4096; - i->current_page->text = malloc(i->current_page->textsize); + i->current_page->text = (char*)malloc(i->current_page->textsize); i->current_page->textpos = 0; i->current_page->next = 0; i->currentx = 0; @@ -120,15 +120,20 @@ void text_drawchar(gfxdevice_t*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*colo } else if(xshift > i->lastadvance*1.3 || xshift<0) { addchar(dev, 32); } - i->lastadvance = font->glyphs[glyphnr].advance*matrix->m00; - - int u = font->glyphs[glyphnr].unicode; + int u; + if(font) { + i->lastadvance = font->glyphs[glyphnr].advance*matrix->m00; + u = font->glyphs[glyphnr].unicode; + } else { + u = glyphnr; + i->currentx = 0;i->currenty = 0; + } if(u>13) { addchar(dev, u); } } -void text_drawlink(gfxdevice_t*dev, gfxline_t*line, char*action) +void text_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action) { internal_t*i = (internal_t*)dev->internal; } @@ -142,7 +147,7 @@ void text_result_write(gfxresult_t*r, int filedesc) { textpage_t*i= (textpage_t*)r->internal; } -int text_result_save(gfxresult_t*r, char*filename) +int text_result_save(gfxresult_t*r, const char*filename) { textpage_t*i= (textpage_t*)r->internal; if(!i) { @@ -158,7 +163,7 @@ int text_result_save(gfxresult_t*r, char*filename) fclose(fi); return 1; } -void*text_result_get(gfxresult_t*r, char*name) +void*text_result_get(gfxresult_t*r, const char*name) { textpage_t*i= (textpage_t*)r->internal; if(!strcmp(name,"text")) { @@ -168,7 +173,7 @@ void*text_result_get(gfxresult_t*r, char*name) len += i->textpos; j = j->next; } - char*text = malloc(len); + char*text = (char*)malloc(len); int pos = 0; j = i; while(j) {