73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
#ifndef __AMSFONTCONVERTER4_HPP__
|
|
#define __AMSFONTCONVERTER4_HPP__
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
|
|
#include <amsmathutil25/amsmathutil25.hpp>
|
|
#include <amsstring4/amsstring4.hpp>
|
|
#include <amscppimglib4/amscppimglib4.hpp>
|
|
|
|
#include <amscppfont4/amscppfont4.hpp>
|
|
|
|
//Freetype libraries
|
|
#include <ft2build.h>
|
|
#include FT_FREETYPE_H
|
|
|
|
namespace ams
|
|
{
|
|
namespace font4
|
|
{
|
|
|
|
static const int fontconverter4_success = 1;
|
|
static const int fontconverter4_failure = -1;
|
|
|
|
//Class intended to open and load a single freetype font-face (single file)
|
|
//Loads glyphs and glyph metrics from .ttf and .otf files using the Freetype library.
|
|
class freetype_fontfaceloader
|
|
{
|
|
public:
|
|
freetype_fontfaceloader();
|
|
~freetype_fontfaceloader();
|
|
|
|
bool bopen; //is fontface file open?
|
|
bool blibinit; //is the freetype library initialized?
|
|
|
|
FT_Library library;
|
|
FT_Face face;
|
|
|
|
//
|
|
int open(const char *fontfilename);
|
|
void close();
|
|
|
|
bool hasglyph(uint32_t charind);
|
|
int getglyph(uint32_t charind, int charheight, amsbitplane *glyph, amsglyphmetrics *glyphmetrics);
|
|
|
|
facemetrics getfacemetrics(int charheight);
|
|
|
|
int load_glyphrange(
|
|
int charheight,
|
|
uint32_t charindmin,
|
|
uint32_t charindmax,
|
|
amsglyphrange *glyphrange_out
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////
|
|
// Tests //
|
|
///////////
|
|
|
|
void test_printglyph(amsbitplane *glyph);
|
|
void test_getglyph1();
|
|
void test_getglyph2();
|
|
void test_facemetrics();
|
|
void test_glyphrange_load();
|
|
|
|
};
|
|
};
|
|
|
|
#endif |