blog/cpp/fonts/core/head.cpp

26 lines
668 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}