blog/cpp/fonts/core/tables/cmap/cmap.cpp

70 lines
1004 B
C++
Raw Permalink Normal View History

2024-09-13 15:10:58 +08:00
#include "cmap.h"
void cmap::read(reader *rd)
{
_header = CmapHeader(rd);
auto curr = rd->curr();
_tableFormat = rd->readUint16();
rd->seek(curr);
switch (_tableFormat)
{
case 0:
{
CmapTable0 t(rd);
_table = &t;
}
break;
case 2:
{
CmapTable2 t(rd);
_table = &t;
}
break;
case 4:
{
CmapTable4 t(rd);
_table = &t;
}
break;
case 6:
{
CmapTable6 t(rd);
_table = &t;
}
break;
case 8:
{
CmapTable8 t(rd);
_table = &t;
}
break;
case 10:
{
CmapTable10 t(rd);
_table = &t;
}
break;
case 12:
{
CmapTable12 t(rd);
_table = &t;
}
break;
case 13:
{
CmapTable13 t(rd);
_table = &t;
}
break;
case 14:
{
CmapTable14 t(rd);
_table = &t;
}
break;
default:
_table = nullptr;
break;
}
}