Ejemplo n.º 1
0
        private static CmapFormat ReadSubtable(FontStreamReader reader, ushort platformId, ushort platformSpecificId, uint offset)
        {
            reader.Push();
            reader.Seek(offset, SeekOrigin.Begin);

            var format = reader.ReadUInt16();

            CmapFormat result;

            switch (format)
            {
            case 0: result = CmapFormat0.Read(reader, platformId, platformSpecificId); break;

            case 2: result = CmapFormat2.Read(reader, platformId, platformSpecificId); break;

            case 4: result = CmapFormat4.Read(reader, platformId, platformSpecificId); break;

            case 6: result = CmapFormat6.Read(reader, platformId, platformSpecificId); break;

            case 8: result = CmapFormat8.Read(reader, platformId, platformSpecificId); break;

            case 10: result = CmapFormat10.Read(reader, platformId, platformSpecificId); break;

            case 12: result = CmapFormat12.Read(reader, platformId, platformSpecificId); break;

            case 13: result = CmapFormat13.Read(reader, platformId, platformSpecificId); break;

            case 14: result = CmapFormat14.Read(reader, platformId, platformSpecificId); break;

            default: throw new FormatException($"Unexpected cmap subtable format: {format}");
            }

            reader.Pop();

            return(result);
        }