blog/cpp/fonts/core/head.cpp

26 lines
668 B
C++
Raw Normal View History

2024-09-13 15:10:58 +08:00
#include "head.h"
#include <iostream>
void fontHead::read(reader* rd){
//先读4字节看是ttf还是ttc
auto ft = rd->readString(4);
if(ft == "ttcf"){
throw "not support ttc";
}
rd->seek(0);
verMain = rd->readUint16();
verSub = rd->readUint16();
tableCount = rd->readUint16();
auto arg1 = rd->readUint16();
args.push_back(arg1);
auto arg2 = rd->readUint16();
args.push_back(arg2);
auto arg3 = rd->readUint16();
args.push_back(arg3);
}
void fontHead::display(){
std::cout<<"this is header"<<std::endl;
std::cout<<"version: "<<verMain<<"."<<verSub<<"\ttableCount: "<<tableCount<<std::endl;
}