39 lines
987 B
C++
39 lines
987 B
C++
#pragma once
|
|
|
|
#include "ofMain.h"
|
|
#include "ofTrueTypeFont.h"
|
|
#include <freetype2/freetype/freetype.h>
|
|
#include <msdf-atlas-gen/msdf-atlas-gen.h>
|
|
#include <msdf-atlas-gen/types.h>
|
|
#include "conversion.h"
|
|
|
|
namespace ofxMsdfgen {
|
|
struct AtlasSettings {
|
|
float maxCornerAngle = 3.0;
|
|
float scale = 24.0;
|
|
float minimumScale = 24.0;
|
|
float pixelRange = 2.0;
|
|
float miterLimit = 1.0;
|
|
string characters = "charset::ascii";
|
|
#ifdef TARGET_EMSCRIPTEN
|
|
int threadCount = 1;
|
|
#else
|
|
int threadCount = 4;
|
|
#endif
|
|
};
|
|
class Atlas {
|
|
public:
|
|
Atlas();
|
|
~Atlas();
|
|
void setup(string _fontPath);
|
|
void setup(string _fontPath, AtlasSettings _settings);
|
|
bool generate();
|
|
const ofImage & getAtlasImage();
|
|
const vector <GlyphGeometry> & getGlyphGeometries();
|
|
AtlasSettings settings;
|
|
private:
|
|
string fontPath;
|
|
ofImage atlasImage;
|
|
vector <GlyphGeometry> glyphGeometries;
|
|
};
|
|
}
|