static AxisTable ReadAxisTable(BinaryReader reader) { //An Axis table is used to render scripts either horizontally or vertically. //It consists of offsets, measured from the beginning of the Axis table, //to a BaseTagList and a BaseScriptList: //The BaseScriptList enumerates all scripts rendered in the text layout direction. //The BaseTagList enumerates all baselines used to render the scripts in the text layout direction. //If no baseline data is available for a text direction, //the offset to the corresponding BaseTagList may be set to NULL. //Axis Table //Type Name Description //Offset16 baseTagListOffset Offset to BaseTagList table, from beginning of Axis table(may be NULL) //Offset16 baseScriptListOffset Offset to BaseScriptList table, from beginning of Axis table long axisTableStartAt = reader.BaseStream.Position; ushort baseTagListOffset = reader.ReadUInt16(); ushort baseScriptListOffset = reader.ReadUInt16(); AxisTable axisTable = new AxisTable(); if (baseTagListOffset > 0) { reader.BaseStream.Position = axisTableStartAt + baseTagListOffset; axisTable.baseTagList = ReadBaseTagList(reader); } if (baseScriptListOffset > 0) { reader.BaseStream.Position = axisTableStartAt + baseScriptListOffset; axisTable.baseScripts = ReadBaseScriptList(reader); } return(axisTable); }
public AxisTable GetVertAxisTable() { AxisTable at = null; if (VertAxisOffset != 0) { at = new AxisTable(VertAxisOffset, m_bufTable); } return(at); }
public AxisTable GetHorizAxisTable() { AxisTable at = null; if (HorizAxisOffset != 0) { at = new AxisTable(HorizAxisOffset, m_bufTable); } return(at); }
protected override void ReadContentFrom(BinaryReader reader) { //BASE Header //The BASE table begins with a header that starts with a version number. //Two versions are defined. //Version 1.0 contains offsets to horizontal and vertical Axis tables(HorizAxis and VertAxis). //Version 1.1 also includes an offset to an Item Variation Store table. //Each Axis table stores all baseline information and min / max extents for one layout direction. //The HorizAxis table contains Y values for horizontal text layout; //the VertAxis table contains X values for vertical text layout. // A font may supply information for both layout directions. //If a font has values for only one text direction, //the Axis table offset value for the other direction will be set to NULL. //The optional Item Variation Store table is used in variable fonts to provide variation data //for BASE metric values within the Axis tables. // BASE Header, Version 1.0 //Type Name Description //uint16 majorVersion Major version of the BASE table, = 1 //uint16 minorVersion Minor version of the BASE table, = 0 //Offset16 horizAxisOffset Offset to horizontal Axis table, from beginning of BASE table(may be NULL) //Offset16 vertAxisOffset Offset to vertical Axis table, from beginning of BASE table(may be NULL) //BASE Header, Version 1.1 //Type Name Description //uint16 majorVersion Major version of the BASE table, = 1 //uint16 minorVersion Minor version of the BASE table, = 1 //Offset16 horizAxisOffset Offset to horizontal Axis table, from beginning of BASE table(may be NULL) //Offset16 vertAxisOffset Offset to vertical Axis table, from beginning of BASE table(may be NULL) //Offset32 itemVarStoreOffset Offset to Item Variation Store table, from beginning of BASE table(may be null) long tableStartAt = reader.BaseStream.Position; ushort majorVersion = reader.ReadUInt16(); ushort minorVersion = reader.ReadUInt16(); ushort horizAxisOffset = reader.ReadUInt16(); ushort vertAxisOffset = reader.ReadUInt16(); uint itemVarStoreOffset = 0; if (minorVersion == 1) { itemVarStoreOffset = reader.ReadUInt32(); } //Axis Tables: HorizAxis and VertAxis if (horizAxisOffset > 0) { reader.BaseStream.Position = tableStartAt + horizAxisOffset; _horizontalAxis = ReadAxisTable(reader); _horizontalAxis.isVerticalAxis = false; } if (vertAxisOffset > 0) { reader.BaseStream.Position = tableStartAt + vertAxisOffset; _verticalAxis = ReadAxisTable(reader); _verticalAxis.isVerticalAxis = true; } if (itemVarStoreOffset > 0) { //TODO } }
public AxisTable GetVertAxisTable() { AxisTable at = null; if (VertAxisOffset != 0) { at = new AxisTable(VertAxisOffset, m_bufTable); } return at; }
public AxisTable GetHorizAxisTable() { AxisTable at = null; if (HorizAxisOffset != 0) { at = new AxisTable(HorizAxisOffset, m_bufTable); } return at; }