123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- #region MIT License
- /*Copyright (c) 2012 Robert Rouhani <robert.rouhani@gmail.com>
- SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.*/
- #endregion
- using System;
- using System.Runtime.InteropServices;
- using SharpFont.Fnt.Internal;
- namespace SharpFont.Fnt
- {
- /// <summary>
- /// Windows FNT Header info.
- /// </summary>
- public class Header
- {
- #region Fields
- private IntPtr reference;
- private HeaderRec rec;
- #endregion
- #region Constructors
- internal Header(IntPtr reference)
- {
- Reference = reference;
- }
- #endregion
- #region Properties
- [CLSCompliant(false)]
- public ushort Version
- {
- get
- {
- return rec.version;
- }
- }
- [CLSCompliant(false)]
- public uint FileSize
- {
- get
- {
- return (uint)rec.file_size;
- }
- }
- public byte[] Copyright
- {
- get
- {
- return rec.copyright;
- }
- }
- [CLSCompliant(false)]
- public ushort FileType
- {
- get
- {
- return rec.file_type;
- }
- }
- [CLSCompliant(false)]
- public ushort NominalPointSize
- {
- get
- {
- return rec.nominal_point_size;
- }
- }
- [CLSCompliant(false)]
- public ushort VerticalResolution
- {
- get
- {
- return rec.vertical_resolution;
- }
- }
- [CLSCompliant(false)]
- public ushort HorizontalResolution
- {
- get
- {
- return rec.horizontal_resolution;
- }
- }
- [CLSCompliant(false)]
- public ushort Ascent
- {
- get
- {
- return rec.ascent;
- }
- }
- [CLSCompliant(false)]
- public ushort InternalLeading
- {
- get
- {
- return rec.internal_leading;
- }
- }
- [CLSCompliant(false)]
- public ushort ExternalLeading
- {
- get
- {
- return rec.external_leading;
- }
- }
- public byte Italic
- {
- get
- {
- return rec.italic;
- }
- }
- public byte Underline
- {
- get
- {
- return rec.underline;
- }
- }
- public byte Strikeout
- {
- get
- {
- return rec.strike_out;
- }
- }
- [CLSCompliant(false)]
- public ushort Weight
- {
- get
- {
- return rec.weight;
- }
- }
- public byte Charset
- {
- get
- {
- return rec.charset;
- }
- }
- [CLSCompliant(false)]
- public ushort PixelWidth
- {
- get
- {
- return rec.pixel_width;
- }
- }
- [CLSCompliant(false)]
- public ushort PixelHeight
- {
- get
- {
- return rec.pixel_height;
- }
- }
- public byte PitchAndFamily
- {
- get
- {
- return rec.pitch_and_family;
- }
- }
- [CLSCompliant(false)]
- public ushort AverageWidth
- {
- get
- {
- return rec.avg_width;
- }
- }
- [CLSCompliant(false)]
- public ushort MaximumWidth
- {
- get
- {
- return rec.max_width;
- }
- }
- public byte FirstChar
- {
- get
- {
- return rec.first_char;
- }
- }
- public byte LastChar
- {
- get
- {
- return rec.last_char;
- }
- }
- public byte DefaultChar
- {
- get
- {
- return rec.default_char;
- }
- }
- public byte BreakChar
- {
- get
- {
- return rec.break_char;
- }
- }
- [CLSCompliant(false)]
- public ushort BytesPerRow
- {
- get
- {
- return rec.bytes_per_row;
- }
- }
- [CLSCompliant(false)]
- public uint DeviceOffset
- {
- get
- {
- return (uint)rec.device_offset;
- }
- }
- [CLSCompliant(false)]
- public uint FaceNameOffset
- {
- get
- {
- return (uint)rec.face_name_offset;
- }
- }
- [CLSCompliant(false)]
- public uint BitsPointer
- {
- get
- {
- return (uint)rec.bits_pointer;
- }
- }
- [CLSCompliant(false)]
- public uint BitsOffset
- {
- get
- {
- return (uint)rec.bits_offset;
- }
- }
- public byte Reserved
- {
- get
- {
- return rec.reserved;
- }
- }
- [CLSCompliant(false)]
- public uint Flags
- {
- get
- {
- return (uint)rec.flags;
- }
- }
- [CLSCompliant(false)]
- public ushort ASpace
- {
- get
- {
- return rec.A_space;
- }
- }
- [CLSCompliant(false)]
- public ushort BSpace
- {
- get
- {
- return rec.B_space;
- }
- }
- [CLSCompliant(false)]
- public ushort CSpace
- {
- get
- {
- return rec.C_space;
- }
- }
- [CLSCompliant(false)]
- public ushort ColorTableOffset
- {
- get
- {
- return rec.color_table_offset;
- }
- }
- [CLSCompliant(false)]
- public uint[] Reserved1
- {
- get
- {
- #if WIN64
- return rec.reserved1;
- #else
- return Array.ConvertAll<UIntPtr, uint>(rec.reserved1, new Converter<UIntPtr, uint>(delegate(UIntPtr u) { return (uint)u; }));
- #endif
- }
- }
- internal IntPtr Reference
- {
- get
- {
- return reference;
- }
- set
- {
- reference = value;
- rec = PInvokeHelper.PtrToStructure<HeaderRec>(reference);
- }
- }
- #endregion
- }
- }
|