Exemple #1
0
 public static XElement ToXml(KerningRecord record)
 {
     return(new XElement("WideKerning",
                         new XAttribute("a", record.LeftCode),
                         new XAttribute("b", record.RightCode),
                         new XAttribute("adjustment", record.Adjustment)));
 }
Exemple #2
0
 public static KerningRecord ReadKerningRecord(this ISwfStreamReader reader, bool wideCodes)
 {
     var res = new KerningRecord {
         LeftCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(),
         RightCode = wideCodes ? reader.ReadUInt16() : reader.ReadByte(),
         Adjustment = reader.ReadSInt16()
     };
     return res;
 }
Exemple #3
0
        public static KerningRecord ReadKerningRecord(this ISwfStreamReader reader, bool wideCodes)
        {
            var res = new KerningRecord {
                LeftCode   = wideCodes ? reader.ReadUInt16() : reader.ReadByte(),
                RightCode  = wideCodes ? reader.ReadUInt16() : reader.ReadByte(),
                Adjustment = reader.ReadSInt16()
            };

            return(res);
        }
Exemple #4
0
 public static void WriteKerningRecord(this ISwfStreamWriter writer, KerningRecord record, bool wideCodes)
 {
     if (wideCodes) {
         writer.WriteUInt16(record.LeftCode);
         writer.WriteUInt16(record.RightCode);
     } else {
         writer.WriteByte((byte)record.LeftCode);
         writer.WriteByte((byte)record.RightCode);
     }
     writer.WriteSInt16(record.Adjustment);
 }
Exemple #5
0
 public static void WriteKerningRecord(this ISwfStreamWriter writer, KerningRecord record, bool wideCodes)
 {
     if (wideCodes)
     {
         writer.WriteUInt16(record.LeftCode);
         writer.WriteUInt16(record.RightCode);
     }
     else
     {
         writer.WriteByte((byte)record.LeftCode);
         writer.WriteByte((byte)record.RightCode);
     }
     writer.WriteSInt16(record.Adjustment);
 }
Exemple #6
0
        /// <summary>
        /// Parses the layout of this tag.
        /// </summary>
        /// <param name="input">The input stream where to read from.</param>
        protected virtual void ParseLayout(Stream input)
        {
            BinaryReader br = new BinaryReader(input);

            if (this._fontFlagsHasLayout)
            {

                this._fontAscent = br.ReadInt16();
                this._fontDescent = br.ReadInt16();
                this._fontLeading = br.ReadInt16();

                this._fontAdvanceTable = new Int16[this._numberOfGlyphs];

                for (int i = 0; i < this._numberOfGlyphs; i++)
                {
                    this._fontAdvanceTable[i] = br.ReadInt16();
                }

                this._fontBoundsTable = new Rect[this._numberOfGlyphs];

                for (int i = 0; i < this._numberOfGlyphs; i++)
                {
                    Rect r = new Rect(this._SwfVersion);
                    r.Parse(this._dataStream);
                    this._fontBoundsTable[i] = r;
                }

                this._kerningCount = br.ReadUInt16();

                this._fontKerningTable = new KerningRecord[this._kerningCount];

                for (int i = 0; i < this._kerningCount; i++)
                {
                    KerningRecord r = new KerningRecord(this._SwfVersion);
                    r.Parse(this._dataStream, this._fontFlagsWideCodes);
                    this._fontKerningTable[i] = r;
                }
            }
        }