19 pl_font
hp_convert(char ** fontdata
, int scale
){
26 pl_glyph
* glyphs
=NULL
;
28 for (charcode
=0; charcode
<128; charcode
++){
29 char * glyphdata
=fontdata
[charcode
];
30 if (strlen(glyphdata
)){ /* There IS a glyph */
32 glyphs
=realloc(glyphs
,sizeof(pl_glyph
)*++font_size
);
34 pl_point
* points
=malloc(sizeof(pl_point
));
35 points
[0].p_data
=7*scale
+82+82*0x100;
37 for (pos
=0; pos
<strlen(glyphdata
); pos
++){
38 points
=realloc(points
,sizeof(pl_point
)*++glyph_size
);
40 if (! (glyphdata
[pos
]&0x80)){ /* Moveto instruction */
41 points
[glyph_size
-1].p_data
=020122; /* Pen up code */
42 points
=realloc(points
,sizeof(pl_point
)*++glyph_size
);
44 int x
=(((glyphdata
[pos
]&0x70)>>4)*scale
)+82;
45 int y
=82-((glyphdata
[pos
]&0xf)*scale
);
46 points
[glyph_size
-1].p_data
=(x
<<8)+(y
);
48 glyphs
[font_size
-1].gl_points
=points
;
49 glyphs
[font_size
-1].gl_number
=charcode
;
50 glyphs
[font_size
-1].gl_size
=glyph_size
;
51 glyphs
[font_size
-1].gl_comment
=NULL
;
52 glyphs
[font_size
-1].gl_label
=NULL
;
56 if (charcode
==32){ /* SPACE */
57 glyphs
=realloc(glyphs
,sizeof(pl_glyph
)*++font_size
);
58 pl_point
* points
=malloc(sizeof(pl_point
));
59 points
[0].p_data
=7*scale
+82+82*0x100;
60 glyphs
[font_size
-1].gl_points
=points
;
61 glyphs
[font_size
-1].gl_number
=32;
62 glyphs
[font_size
-1].gl_size
=1;
63 glyphs
[font_size
-1].gl_label
=NULL
;
64 glyphs
[font_size
-1].gl_comment
=NULL
;
69 result
.f_size
=font_size
;
70 result
.f_glyphs
=glyphs
;
71 result
.f_label
="PL$FNT";
72 result
.f_base
=4*scale
;
73 result
.f_top
=10*scale
;
74 result
.f_offset
=11*scale
;
75 result
.f_comment
="HP AUTOMATIC";