X-Git-Url: http://gitweb.hachti.de/?a=blobdiff_plain;f=pc-tools%2Ffontgen%2Fsrc%2Fhp.c;fp=pc-tools%2Ffontgen%2Fsrc%2Fhp.c;h=0cee5f99ea044976f6c6c2fc072f3614f4765b0d;hb=5e2538182c99ec053b457255722f704927a5f003;hp=0000000000000000000000000000000000000000;hpb=b82408e342cb04c0f21fcb9314c1d76eb9e13190;p=h316.git diff --git a/pc-tools/fontgen/src/hp.c b/pc-tools/fontgen/src/hp.c new file mode 100644 index 0000000..0cee5f9 --- /dev/null +++ b/pc-tools/fontgen/src/hp.c @@ -0,0 +1,77 @@ +#include +#include +#include + +#include "fontgen.h" + +#include "charset0.h" +#include "charset1.h" +#include "charset2.h" +#include "charset3.h" +#include "charset4.h" +#include "charset5.h" +#include "charset6.h" +#include "charset7.h" +#include "font173.h" +#include "font205.h" + + +pl_font hp_convert(char ** fontdata, int scale){ + + int charcode=0; + int pos=0; + + int font_size=0; + + pl_glyph * glyphs=NULL; + + for (charcode=0; charcode<128; charcode++){ + char * glyphdata=fontdata[charcode]; + if (strlen(glyphdata)){ /* There IS a glyph */ + + glyphs=realloc(glyphs,sizeof(pl_glyph)*++font_size); + int glyph_size=1; + pl_point * points=malloc(sizeof(pl_point)); + points[0].p_data=7*scale+82+82*0x100; + + for (pos=0; pos>4)*scale)+82; + int y=82-((glyphdata[pos]&0xf)*scale); + points[glyph_size-1].p_data=(x<<8)+(y); + } + glyphs[font_size-1].gl_points=points; + glyphs[font_size-1].gl_number=charcode; + glyphs[font_size-1].gl_size=glyph_size; + glyphs[font_size-1].gl_comment=NULL; + glyphs[font_size-1].gl_label=NULL; + + + } else { + if (charcode==32){ /* SPACE */ + glyphs=realloc(glyphs,sizeof(pl_glyph)*++font_size); + pl_point * points=malloc(sizeof(pl_point)); + points[0].p_data=7*scale+82+82*0x100; + glyphs[font_size-1].gl_points=points; + glyphs[font_size-1].gl_number=32; + glyphs[font_size-1].gl_size=1; + glyphs[font_size-1].gl_label=NULL; + glyphs[font_size-1].gl_comment=NULL; + } + } + } + pl_font result; + result.f_size=font_size; + result.f_glyphs=glyphs; + result.f_label="PL$FNT"; + result.f_base=4*scale; + result.f_top=10*scale; + result.f_offset=11*scale; + result.f_comment="HP AUTOMATIC"; + return result; +}