*** empty log message ***
[h316.git] / pc-tools / fontgen / src / hershey.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "fontgen.h"
4
5 pl_glyph find_glyph(int number){
6 int i;
7 for (i=0;i<hershey_fonts.f_size;i++){
8 // DBG("find: i=%i, number=%i\n",i,hershey_fonts.f_glyphs[i].gl_number);
9 if (hershey_fonts.f_glyphs[i].gl_number==number){
10 return hershey_fonts.f_glyphs[i];
11 }
12 }
13 fprintf(stderr,"Error! Glyph not found! (%i)\n",number);
14 exit (2);
15 pl_glyph muh={};
16 return muh;
17 }
18
19 pl_font assemble_font(int first_id, int size, int * glyph_ids){
20 pl_font result;
21 int id=first_id;
22 int i;
23 pl_glyph * glyphs=(pl_glyph *) malloc (size *sizeof(pl_glyph));
24
25 for (i=0; i<size;i++){
26 glyphs[i]=find_glyph(glyph_ids[i]);
27 glyphs[i].gl_number=id;
28 id++;
29 }
30 result.f_glyphs=glyphs;
31 result.f_size=size;
32 result.f_label="PL\$FNT";
33 return result;
34 }