00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef EGGMAKEFONT_H
00020 #define EGGMAKEFONT_H
00021
00022 #include <pandatoolbase.h>
00023
00024 #include "charLayout.h"
00025
00026 #include <eggWriter.h>
00027 #include <luse.h>
00028 #include <pnmImage.h>
00029
00030 class CharPlacement;
00031 class CharBitmap;
00032 class EggGroup;
00033 class EggTexture;
00034 class EggVertexPool;
00035 class EggVertex;
00036 class FontFile;
00037
00038
00039
00040
00041
00042
00043
00044
00045 class EggMakeFont : public EggWriter {
00046 public:
00047 EggMakeFont();
00048
00049 protected:
00050 virtual bool handle_args(Args &args);
00051 static bool dispatch_dimensions(ProgramBase *self, const string &opt, const string &arg, void *);
00052 bool ns_dispatch_dimensions(const string &opt, const string &arg);
00053
00054 private:
00055 TexCoordd get_uv(double x, double y);
00056 LPoint2d get_xy(double x, double y);
00057 EggVertex *make_vertex(const LPoint2d &xy);
00058
00059 void copy_character(const CharPlacement &pl);
00060
00061 bool consider_scale_factor(double scale_factor);
00062 void choose_scale_factor(double too_small, double too_large);
00063 bool choose_scale_factor();
00064 void choose_image_size();
00065
00066 void unsmooth_rgb(PNMImage &image);
00067 string expand_hyphen(const string &str);
00068
00069 public:
00070 void run();
00071
00072 private:
00073 Filename _output_image_filename;
00074 Filename _input_font_filename;
00075 bool _got_output_size;
00076 Colorf _fg, _bg;
00077 bool _use_alpha;
00078 int _output_xsize, _output_ysize, _output_zsize;
00079 double _buffer_pixels;
00080 double _poly_pixels;
00081 bool _got_scale_factor;
00082 double _scale_factor;
00083 bool _no_reduce;
00084 double _gaussian_radius;
00085 double _ds;
00086 double _scale;
00087 double _ppu;
00088 bool _get_all;
00089 string _only_chars;
00090 bool _small_caps;
00091 double _small_caps_scale;
00092
00093 FontFile *_font;
00094 typedef pmap<int, PT(EggGroup)> EggDefs;
00095 EggDefs _egg_defs;
00096
00097 CharLayout _layout;
00098 int _working_xsize, _working_ysize;
00099 int _working_buffer_pixels;
00100 double _working_poly_pixels;
00101
00102 PNMImage _output_image;
00103
00104 EggVertexPool *_vpool;
00105 EggGroup *_group;
00106 EggTexture *_tref;
00107 };
00108
00109
00110 #endif
00111