Exemple #1
0
        private static int DataLength(this CMapSubTable subtable)
        {
            if (subtable is Format0SubTable)
            {
                return(6 + ((Format0SubTable)subtable).GlyphIds.Length);
            }

            if (subtable is Format4SubTable)
            {
                Format4SubTable.Segment[] segs = ((Format4SubTable)subtable).Segments;
                ushort[] glyphs = ((Format4SubTable)subtable).GlyphIds;
                return(16 + (segs.Length * 8) + (glyphs.Length * 2));
            }

            return(0);
        }
Exemple #2
0
        public CMapTable(CMapSubTable[] tables)
        {
            this.Tables = tables;

            // lets just pick the best table for us.. lets jsut treat everything as windows and get the format 4 if possible
            CMapSubTable table = null;

            foreach (CMapSubTable t in this.Tables)
            {
                if (t != null)
                {
                    if (t.Platform == PlatformIDs.Windows)
                    {
                        ushort format = table?.Format ?? 0;
                        if (t.Format > format)
                        {
                            table = t;
                        }
                    }
                }
            }

            this.table = table;
        }
Exemple #3
0
 public static void WriteCMapSubTable(this BinaryWriter writer, CMapSubTable subtable)
 {
     writer.WriteCMapSubTable(subtable as Format0SubTable);
     writer.WriteCMapSubTable(subtable as Format4SubTable);
 }