Start font reading support.
This commit is contained in:
parent
92e7a78710
commit
ed925afabf
22 changed files with 599 additions and 220 deletions
53
src/fonts/TrueTypeFont.h
Normal file
53
src/fonts/TrueTypeFont.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
#include "IFont.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
|
||||
class TrueTypeFont : public IFont
|
||||
{
|
||||
public:
|
||||
|
||||
using Fixed = int32_t;
|
||||
using LongDateTime = int64_t;
|
||||
using FWord = int16_t;
|
||||
|
||||
// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html
|
||||
struct HeadTable
|
||||
{
|
||||
Fixed version{0};
|
||||
Fixed fontRevision{0};
|
||||
uint32_t checksumAdjustment{0};
|
||||
uint32_t magicNumber{0};
|
||||
uint16_t flags{0};
|
||||
uint16_t unitsPerEm{0};
|
||||
LongDateTime created{0};
|
||||
LongDateTime modified{0};
|
||||
FWord xMin{0};
|
||||
FWord yMin{0};
|
||||
FWord xMax{0};
|
||||
FWord yMax{0};
|
||||
uint16_t macStyle{0};
|
||||
uint16_t lowestRecPPEM{0};
|
||||
int16_t fontDirectionHint{0};
|
||||
int16_t indexToLocFormat{0};
|
||||
int16_t glyphDataFormat{0};
|
||||
};
|
||||
|
||||
std::string logHeadTable() const;
|
||||
|
||||
void setHeadTable(const HeadTable& table)
|
||||
{
|
||||
mHeadTable = table;
|
||||
}
|
||||
|
||||
void dumpInfo() override
|
||||
{
|
||||
std::cout << "Got ttf" << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
HeadTable mHeadTable;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue