Start font reading support.
This commit is contained in:
parent
92e7a78710
commit
ed925afabf
22 changed files with 599 additions and 220 deletions
54
src/fonts/FontReader.h
Normal file
54
src/fonts/FontReader.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "IFont.h"
|
||||
#include "File.h"
|
||||
|
||||
class File;
|
||||
|
||||
class FontReader
|
||||
{
|
||||
public:
|
||||
~FontReader();
|
||||
void setPath(const std::string& path);
|
||||
|
||||
std::unique_ptr<IFont> read();
|
||||
|
||||
private:
|
||||
|
||||
struct OffsetSubtable
|
||||
{
|
||||
uint32_t scaler_type{0};
|
||||
uint16_t num_tables{0};
|
||||
uint16_t search_range{0};
|
||||
uint16_t entry_selector{0};
|
||||
uint16_t range_shift{0};
|
||||
};
|
||||
|
||||
struct Table
|
||||
{
|
||||
std::string name;
|
||||
unsigned checksum{0};
|
||||
unsigned offset{0};
|
||||
unsigned length{0};
|
||||
};
|
||||
|
||||
bool readOffsetSubtable();
|
||||
void logOffsetSubtable();
|
||||
void logTable(const Table& table);
|
||||
|
||||
void readTableDirectory();
|
||||
|
||||
void readTable();
|
||||
void readHeadTable();
|
||||
|
||||
unsigned mCurrentOffset{0};
|
||||
OffsetSubtable mOffsetSubtable;
|
||||
std::vector<Table> mTables;
|
||||
|
||||
std::unique_ptr<IFont> mWorkingFont;
|
||||
std::unique_ptr<File> mFile;
|
||||
std::string mPath;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue