--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#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<strlen(glyphdata); pos++){
+ points=realloc(points,sizeof(pl_point)*++glyph_size);
+
+ if (! (glyphdata[pos]&0x80)){ /* Moveto instruction */
+ points[glyph_size-1].p_data=020122; /* Pen up code */
+ points=realloc(points,sizeof(pl_point)*++glyph_size);
+ }
+ int x=(((glyphdata[pos]&0x70)>>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;
+}