├── Compat ├── Compat.cs ├── Win32APIs.cs └── WinVerifyTrustAPI.cs ├── FontVal ├── App.ico ├── AssemblyInfo.cs ├── Btn1.ico ├── Btn2.ico ├── Btn3.ico ├── Btn4.ico ├── Btn5.ico ├── Btn6.ico ├── ClassDiagram1.cd ├── ClassDiagram2.cd ├── FontVal.Form1.resources ├── FontVal.Form1.resx ├── FontVal.FormAbout.resources ├── FontVal.FormAbout.resx ├── FontVal.FormReportOptions.resources ├── FontVal.FormReportOptions.resx ├── FontVal.FormTransform.resources ├── FontVal.FormTransform.resx ├── FontVal.ResultsForm.resources ├── FontVal.ResultsForm.resx ├── Form1.cs ├── FormAbout.cs ├── FormReportOptions.cs ├── FormTransform.cs ├── Program.cs ├── Progress.cs ├── ResultsForm.cs ├── Settings.cs ├── WebBrowse.cs ├── app.config ├── fval.xsl └── project.cs ├── FontValidator └── CmdLineInterface.cs ├── GMath ├── AssemblyInfo.cs ├── Bez2D.cs ├── BoxD.cs ├── CNum.cs ├── Component.cs ├── Composite.cs ├── Contour.cs ├── DegenD.cs ├── Equation.cs ├── ExceptionGMath.cs ├── GConsts.cs ├── I_CurveD.cs ├── I_Draw.cs ├── I_Drawable.cs ├── InfoConnect.cs ├── InfoDrawable.cs ├── InfoInters.cs ├── Intersect.cs ├── Knot.cs ├── LineD.cs ├── ListInfoInters.cs ├── MConsts.cs ├── MDrawParam.cs ├── MatrixD.cs ├── Outline.cs ├── PairInt.cs ├── Param.cs ├── RayD.cs ├── SegD.cs └── VecD.cs ├── GenerateFValData ├── GenerateFValData.csproj ├── HelpGen.cs ├── Helpers.cs ├── Index.hhk ├── OurData.xml ├── Properties │ └── AssemblyInfo.cs ├── ValTests.cs ├── help-proj-postamble.txt ├── help-proj-preamble.txt ├── helpitems.xsd ├── interpretinglog.htm ├── introtofv.htm ├── legacy.htm ├── resources.htm ├── startbutton.jpg ├── template-contents.txt ├── template.txt ├── toc-error-postamble.txt ├── toc-error-preamble.txt ├── toc-info-postamble.txt ├── toc-info-preamble.txt ├── toc-postamble.txt ├── toc-preamble.txt ├── toc-warning-postamble.txt ├── toc-warning-preamble.txt ├── tooloverview.htm ├── usingvalidator.htm ├── valstrings-postamble.txt └── valstrings-preamble.txt ├── Glyph ├── AssemblyInfo.cs ├── ClassDiagram1.cd ├── DIWrapper.cs ├── DefsGC.cs ├── DefsGM.cs ├── DefsGV.cs ├── ExceptionGlyph.cs ├── FManager.cs ├── Flags.cs ├── FlagsGV.cs ├── GDrawParam.cs ├── GErr.cs ├── GErrConsts.cs ├── GErrFile.cs ├── GErrList.cs ├── GErrPool.cs ├── GErrSign.cs ├── GRelations.cs ├── GScope.cs ├── GStore.cs ├── Glyph.cs ├── I_IOGlyphs.cs ├── I_ProgressUpdator.cs ├── NS_Glyph.GErrStrings.resources ├── NS_Glyph.GErrStrings.resx └── StatusGV.cs ├── License.md ├── Makefile ├── OTFontFile ├── AssemblyInfo.cs ├── ClassDiagram1.cd ├── ClassDiagram2.cd ├── MBOBuffer.cs ├── OTFile.cs ├── OTFont.cs ├── OTL.cs ├── OTTable.cs ├── TAble_Zapf.cs ├── TTCHeader.cs ├── TableManager.cs ├── Table_BASE.cs ├── Table_CFF.cs ├── Table_DSIG.cs ├── Table_EBDT.cs ├── Table_EBLC.cs ├── Table_EBSC.cs ├── Table_GDEF.cs ├── Table_GPOS.cs ├── Table_GSUB.cs ├── Table_JSTF.cs ├── Table_LTSH.cs ├── Table_OS2.cs ├── Table_PCLT.cs ├── Table_VDMX.cs ├── Table_VORG.cs ├── Table__Unknown.cs ├── Table_cmap.cs ├── Table_cvt.cs ├── Table_fpgm.cs ├── Table_gasp.cs ├── Table_glyf.cs ├── Table_hdmx.cs ├── Table_head.cs ├── Table_hhea.cs ├── Table_hmtx.cs ├── Table_kern.cs ├── Table_loca.cs ├── Table_maxp.cs ├── Table_name.cs ├── Table_post.cs ├── Table_prep.cs ├── Table_vhea.cs ├── Table_vmtx.cs ├── ottypes.cs └── util.cs ├── OTFontFileVal ├── AssemblyInfo.cs ├── CallbVal.cs ├── ClassDiagram2.cd ├── ITableValidate.cs ├── I_IOGlyphsFile.cs ├── OTFileVal.cs ├── OTFontFileVal.ValStrings.resources ├── OTFontVal.cs ├── OTLVal.cs ├── Overlap.cs ├── PostNames.cs ├── RastTest.cs ├── TableManagerVal.cs ├── ValDriver.cs ├── ValidationInfo.cs ├── Validator.cs ├── ValidatorParameters.cs ├── atoms.cs ├── val_BASE.cs ├── val_CFF.cs ├── val_DSIG.cs ├── val_EBDT.cs ├── val_EBLC.cs ├── val_EBSC.cs ├── val_GDEF.cs ├── val_GPOS.cs ├── val_GSUB.cs ├── val_JSTF.cs ├── val_LTSH.cs ├── val_OS2.cs ├── val_PCLT.cs ├── val_VDMX.cs ├── val_VORG.cs ├── val__Unknown.cs ├── val_cmap.cs ├── val_cvt.cs ├── val_fpgm.cs ├── val_gasp.cs ├── val_glyf.cs ├── val_hdmx.cs ├── val_head.cs ├── val_hhea.cs ├── val_hmtx.cs ├── val_kern.cs ├── val_loca.cs ├── val_maxp.cs ├── val_name.cs ├── val_post.cs ├── val_prep.cs ├── val_vhea.cs └── val_vmtx.cs ├── README-extra.txt ├── README.md ├── README.txt ├── SECURITY.md ├── ValCommon ├── AssemblyInfo.cs ├── DIAction.cs ├── DIActionBuilder.cs ├── DIActionContainer.cs ├── DIActionOnCondBuilder.cs ├── DICond.cs ├── DICondBuilder.cs ├── I_TestReader.cs └── ValInfoBasic.cs ├── ValInterface ├── val.cpp └── val.h └── bin ├── FontValidatorHelp.chm └── fval.xsl /Compat/Compat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace OTFontFile.Rasterizer 5 | { 6 | public class RasterInterf 7 | { 8 | public delegate void RastTestErrorDelegate (string sStringName, string sDetails); 9 | 10 | public delegate void UpdateProgressDelegate (string s); 11 | 12 | static public RasterInterf getInstance() 13 | { 14 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:getInstance"); 15 | } 16 | 17 | public bool RastTest (int resX, int resY, int[] arrPointSizes, 18 | float stretchX, float stretchY, 19 | float rotation, float skew, 20 | float[,] matrix, 21 | bool unknown1, bool unknown2, bool unknown3, uint unknown4, 22 | RastTestErrorDelegate pRastTestErrorDelegate, 23 | UpdateProgressDelegate pUpdateProgressDelegate, 24 | int numGlyphs) 25 | { 26 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:RastTest"); 27 | } 28 | 29 | public DevMetricsData CalcDevMetrics (int Huge_calcHDMX, int Huge_calcLTSH, int Huge_calcVDMX, 30 | ushort numGlyphs, 31 | byte[] phdmxPointSizes, ushort maxHdmxPointSize, 32 | byte uchPixelHeightRangeStart, byte uchPixelHeightRangeEnd, 33 | ushort[] pVDMXxResolution, ushort[] pVDMXyResolution, 34 | ushort cVDMXResolutions, UpdateProgressDelegate pUpdateProgressDelegate) 35 | { 36 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:CalcDevMetrics"); 37 | } 38 | 39 | public ushort RasterNewSfnt (FileStream fontFileStream, uint faceIndex) 40 | { 41 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:RasterNewSfnt"); 42 | } 43 | 44 | public void CancelRastTest () 45 | { 46 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:CancelRastTest"); 47 | } 48 | 49 | public void CancelCalcDevMetrics () 50 | { 51 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:CancelCalcDevMetrics"); 52 | } 53 | 54 | public int GetRastErrorCount () 55 | { 56 | throw new NotImplementedException("UnImplemented OTFontFile.Rasterizer:GetRastErrorCount"); 57 | } 58 | 59 | public class DevMetricsData 60 | { 61 | public HDMX hdmxData; 62 | public LTSH ltshData; 63 | public VDMX vdmxData; 64 | } 65 | 66 | // These structures largely have their OTSPEC meanings, 67 | // except there is no need to store array lengths seperately 68 | // as .NET arrays know their own lengths. 69 | 70 | public class HDMX 71 | { 72 | public HDMX_DeviceRecord[] Records; 73 | } 74 | 75 | public class HDMX_DeviceRecord 76 | { 77 | public byte[] Widths; 78 | } 79 | 80 | public class LTSH 81 | { 82 | public byte[] yPels; 83 | } 84 | 85 | public class VDMX 86 | { 87 | public VDMX_Group[] groups; 88 | } 89 | 90 | public class VDMX_Group 91 | { 92 | public VDMX_Group_vTable[] entry; 93 | } 94 | 95 | public class VDMX_Group_vTable 96 | { 97 | public ushort yPelHeight; 98 | public short yMax; 99 | public short yMin; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /Compat/Win32APIs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Win32APIs 5 | { 6 | public class MultiByte 7 | { 8 | public static uint GetCodePageMaxCharSize (uint CodePage) 9 | { 10 | throw new NotImplementedException("UnImplemented CodePage:" + CodePage + " MaxChar"); 11 | } 12 | 13 | public static bool IsCodePageInstalled (uint CodePage) 14 | { 15 | //Lie about having every CodePage? 16 | throw new NotImplementedException("UnImplemented CodePage:" + CodePage); 17 | } 18 | 19 | public static bool IsCodePageLeadByte (uint CodePage, byte c) 20 | { 21 | throw new NotImplementedException("UnImplemented Win32API.MultiByte/IsCodePageLeadByte: " 22 | + CodePage + ", byte " + c); 23 | } 24 | public static int MultiByteCharToUnicodeChar (uint CodePage, ushort c) 25 | { 26 | throw new NotImplementedException("UnImplemented Win32API.MultiByte/MultiByteCharToUnicodeChar: " 27 | + CodePage + ", char " + c); 28 | } 29 | } 30 | public class SH 31 | { 32 | public static string BrowseForFolder () 33 | { 34 | FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); 35 | folderBrowserDialog.Description = 36 | "Select the directory to save XML font reports to"; 37 | 38 | folderBrowserDialog.ShowNewFolderButton = true; 39 | 40 | // default to user's home, allow navigate to everywhere else 41 | folderBrowserDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); 42 | folderBrowserDialog.RootFolder = Environment.SpecialFolder.MyComputer; 43 | 44 | DialogResult result = folderBrowserDialog.ShowDialog(); 45 | if( result == DialogResult.OK ) 46 | { 47 | return folderBrowserDialog.SelectedPath; 48 | } else { 49 | return null; //compat 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Compat/WinVerifyTrustAPI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace WinVerifyTrustAPI 4 | { 5 | public class WinVerifyTrustWrapper 6 | { 7 | public bool WinVerifyTrustFile (string sFilename) 8 | { 9 | throw new NotImplementedException( "UnImplemented WinVerifyTrustAPI.WinVerifyTrustWrapper/WinVerifyTrustFile" ); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /FontVal/App.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/App.ico -------------------------------------------------------------------------------- /FontVal/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Security.Permissions; 4 | 5 | // 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | // 10 | [assembly: AssemblyTitle("")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("Font Validator")] 15 | [assembly: AssemblyCopyright("Copyright 2001-2009, Microsoft Corporation")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // 20 | // Version information for an assembly consists of the following four values: 21 | // 22 | // Major Version 23 | // Minor Version 24 | // Build Number 25 | // Revision 26 | // 27 | // You can specify all the values or you can default the Revision and Build Numbers 28 | // by using the '*' as shown below: 29 | 30 | [assembly: AssemblyVersion("1.1.*")] 31 | 32 | // 33 | // In order to sign your assembly you must specify a key to use. Refer to the 34 | // Microsoft .NET Framework documentation for more information on assembly signing. 35 | // 36 | // Use the attributes below to control which key is used for signing. 37 | // 38 | // Notes: 39 | // (*) If no key is specified, the assembly is not signed. 40 | // (*) KeyName refers to a key that has been installed in the Crypto Service 41 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 42 | // a key. 43 | // (*) If the KeyFile and the KeyName values are both specified, the 44 | // following processing occurs: 45 | // (1) If the KeyName can be found in the CSP, that key is used. 46 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 47 | // in the KeyFile is installed into the CSP and used. 48 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 49 | // When specifying the KeyFile, the location of the KeyFile should be 50 | // relative to the project output directory which is 51 | // %Project Directory%\obj\. For example, if your KeyFile is 52 | // located in the project directory, you would specify the AssemblyKeyFile 53 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 54 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 55 | // documentation for more information on this. 56 | // 57 | [assembly: AssemblyDelaySign(false)] 58 | [assembly: AssemblyKeyFile("")] 59 | [assembly: AssemblyKeyName("")] 60 | -------------------------------------------------------------------------------- /FontVal/Btn1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn1.ico -------------------------------------------------------------------------------- /FontVal/Btn2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn2.ico -------------------------------------------------------------------------------- /FontVal/Btn3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn3.ico -------------------------------------------------------------------------------- /FontVal/Btn4.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn4.ico -------------------------------------------------------------------------------- /FontVal/Btn5.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn5.ico -------------------------------------------------------------------------------- /FontVal/Btn6.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/Btn6.ico -------------------------------------------------------------------------------- /FontVal/ClassDiagram1.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAABABIAIBAAAQAAAAAAAQAAQAEAABAAAgAAEBA0AA= 7 | project.cs 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FontVal/ClassDiagram2.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | QFDbCAdeijVbQNrRR/Get4DihpM9PEEJBSeAPx0hhjk= 7 | Form1.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAKAAAAAAAAAAAAAAAAAAAAQQAAAEgAAAAAAAAAA= 14 | Form1.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAACAAABAAAAiAAAACAAAEAAAAAAAAAAAAAAA= 21 | FormAbout.cs 22 | 23 | 24 | 25 | 26 | 27 | DBAAACAAACAAAMEAAACAIAQDAAgQAEAABSAAAECgIBA= 28 | FormReportOptions.cs 29 | 30 | 31 | 32 | 33 | 34 | AqCAJAAAACBKBBEBAACAAIEGCAAQAUgBACBAgAEBBAE= 35 | FormTransform.cs 36 | 37 | 38 | 39 | 40 | 41 | AAAEBLFIISQgEBEIAgiAAGASAAQQCgOKAEgAAAAIgAA= 42 | Progress.cs 43 | 44 | 45 | 46 | 47 | 48 | AAAABABIAIBAAAQAAAAAAAQAAQAEAABAAAgAAEBA0AA= 49 | project.cs 50 | 51 | 52 | 53 | 54 | 55 | AAAIAAAAAiACAAAgAACAAEAiAAAEAAAAAACAACAAQAA= 56 | ResultsForm.cs 57 | 58 | 59 | 60 | 61 | 62 | gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAACAAAA= 63 | Form1.cs 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /FontVal/FontVal.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/FontVal.Form1.resources -------------------------------------------------------------------------------- /FontVal/FontVal.FormAbout.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/FontVal.FormAbout.resources -------------------------------------------------------------------------------- /FontVal/FontVal.FormReportOptions.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/FontVal.FormReportOptions.resources -------------------------------------------------------------------------------- /FontVal/FontVal.FormTransform.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/FontVal.FormTransform.resources -------------------------------------------------------------------------------- /FontVal/FontVal.ResultsForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/FontVal/FontVal.ResultsForm.resources -------------------------------------------------------------------------------- /FontVal/FormAbout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Collections; 4 | using System.ComponentModel; 5 | using System.Windows.Forms; 6 | 7 | namespace FontVal 8 | { 9 | /// 10 | /// Summary description for FormAbout. 11 | /// 12 | public class FormAbout : System.Windows.Forms.Form 13 | { 14 | private System.Windows.Forms.Label label1; 15 | private System.Windows.Forms.Label label2; 16 | private System.Windows.Forms.Label label4; 17 | private System.Windows.Forms.LinkLabel linkLabel2; 18 | /// 19 | /// Required designer variable. 20 | /// 21 | private System.ComponentModel.Container components = null; 22 | 23 | public FormAbout() 24 | { 25 | // 26 | // Required for Windows Form Designer support 27 | // 28 | InitializeComponent(); 29 | 30 | // 31 | // TODO: Add any constructor code after InitializeComponent call 32 | // 33 | 34 | // Display the assembly information in a Label. 35 | //Label label1 = new Label(); 36 | label1.Text += " " + this.ProductVersion; 37 | } 38 | 39 | /// 40 | /// Clean up any resources being used. 41 | /// 42 | protected override void Dispose( bool disposing ) 43 | { 44 | if( disposing ) 45 | { 46 | if(components != null) 47 | { 48 | components.Dispose(); 49 | } 50 | } 51 | base.Dispose( disposing ); 52 | } 53 | 54 | #region Windows Form Designer generated code 55 | /// 56 | /// Required method for Designer support - do not modify 57 | /// the contents of this method with the code editor. 58 | /// 59 | private void InitializeComponent() 60 | { 61 | System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormAbout)); 62 | this.label1 = new System.Windows.Forms.Label(); 63 | this.label2 = new System.Windows.Forms.Label(); 64 | this.label4 = new System.Windows.Forms.Label(); 65 | this.linkLabel2 = new System.Windows.Forms.LinkLabel(); 66 | this.SuspendLayout(); 67 | // 68 | // label1 69 | // 70 | this.label1.Location = new System.Drawing.Point(24, 64); 71 | this.label1.Name = "label1"; 72 | this.label1.Size = new System.Drawing.Size(272, 24); 73 | this.label1.TabIndex = 0; 74 | this.label1.Text = "Release"; 75 | this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 76 | // 77 | // label2 78 | // 79 | this.label2.Location = new System.Drawing.Point(24, 32); 80 | this.label2.Name = "label2"; 81 | this.label2.Size = new System.Drawing.Size(272, 23); 82 | this.label2.TabIndex = 1; 83 | this.label2.Text = "Microsoft\u00AE Font Validator"; 84 | this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 85 | // 86 | // label4 87 | // 88 | this.label4.Location = new System.Drawing.Point(24, 136); 89 | this.label4.Name = "label4"; 90 | this.label4.Size = new System.Drawing.Size(272, 23); 91 | this.label4.TabIndex = 4; 92 | this.label4.Text = "Provided by Microsoft\'s typography group"; 93 | this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; 94 | // 95 | // linkLabel2 96 | // 97 | this.linkLabel2.Location = new System.Drawing.Point(24, 160); 98 | this.linkLabel2.Name = "linkLabel2"; 99 | this.linkLabel2.Size = new System.Drawing.Size(272, 23); 100 | this.linkLabel2.TabIndex = 5; 101 | this.linkLabel2.TabStop = true; 102 | this.linkLabel2.Text = "http://www.microsoft.com/typography/"; 103 | this.linkLabel2.TextAlign = System.Drawing.ContentAlignment.TopCenter; 104 | this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); 105 | // 106 | // FormAbout 107 | // 108 | this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 109 | this.ClientSize = new System.Drawing.Size(320, 222); 110 | this.Controls.AddRange(new System.Windows.Forms.Control[] { 111 | this.linkLabel2, 112 | this.label4, 113 | this.label2, 114 | this.label1}); 115 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 116 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 117 | this.MaximizeBox = false; 118 | this.MinimizeBox = false; 119 | this.Name = "FormAbout"; 120 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 121 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 122 | this.Text = "About"; 123 | this.ResumeLayout(false); 124 | 125 | } 126 | #endregion 127 | 128 | private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e) 129 | { 130 | System.Diagnostics.Process.Start(linkLabel2.Text); 131 | } 132 | 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /FontVal/Settings.cs: -------------------------------------------------------------------------------- 1 | namespace FontVal.Properties { 2 | 3 | 4 | // This class allows you to handle specific events on the settings class: 5 | // The SettingChanging event is raised before a setting's value is changed. 6 | // The PropertyChanged event is raised after a setting's value is changed. 7 | // The SettingsLoaded event is raised after the setting values are loaded. 8 | // The SettingsSaving event is raised before the setting values are saved. 9 | internal sealed partial class Settings { 10 | 11 | public Settings() { 12 | // // To add event handlers for saving and changing settings, uncomment the lines below: 13 | // 14 | // this.SettingChanging += this.SettingChangingEventHandler; 15 | // 16 | // this.SettingsSaving += this.SettingsSavingEventHandler; 17 | // 18 | } 19 | 20 | private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { 21 | // Add code to handle the SettingChangingEvent event here. 22 | } 23 | 24 | private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { 25 | // Add code to handle the SettingsSaving event here. 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /FontVal/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /FontVal/project.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml; 3 | using System.Collections; 4 | using System.Diagnostics; 5 | using System.Windows.Forms; 6 | 7 | using OTFontFile; 8 | 9 | namespace FontVal 10 | { 11 | /// 12 | /// Summary description for project. 13 | /// 14 | public class project 15 | { 16 | public project() 17 | { 18 | Clear(); 19 | } 20 | 21 | public void Clear() 22 | { 23 | m_hashTestsToPerform = new Hashtable(); 24 | string [] sTableTypes = TableManager.GetKnownOTTableTypes(); 25 | for (int i=0; i. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /GMath/CNum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace NS_GMath 5 | { 6 | public class CNum 7 | { 8 | /* 9 | * MEMBERS 10 | */ 11 | double re; 12 | double im; 13 | int multiplicity; 14 | 15 | /* 16 | * PROPERTIES 17 | */ 18 | public double Re 19 | { 20 | get { return this.re; } 21 | set { this.re=value; } 22 | } 23 | public double Im 24 | { 25 | get { return this.im; } 26 | set { this.im=value; } 27 | } 28 | public int Multiplicity 29 | { 30 | get { return this.multiplicity; } 31 | set { this.multiplicity=value; } 32 | } 33 | 34 | public double Radius 35 | { 36 | get {return Math.Sqrt(this.re*this.re+this.im*this.im);} 37 | } 38 | 39 | public bool IsZero 40 | { 41 | get { return (this.Radius=this.NumComponent)) 38 | return null; 39 | return this.components[pozComponent] as Component; 40 | 41 | } 42 | 43 | public Component ComponentByIndGlyph(int indGlyph) 44 | { 45 | foreach (Component component in this.components) 46 | { 47 | if (component.IndexGlyphComponent==indGlyph) 48 | { 49 | return component; 50 | } 51 | } 52 | return null; 53 | } 54 | 55 | public int IndGlyphByPozCont(int pozCont) 56 | { 57 | /* 58 | * returns IND_UNDEFINED on failure 59 | */ 60 | int numCont=0; 61 | foreach (Component component in this.components) 62 | { 63 | if (component.NumCont==GConsts.IND_UNINITIALIZED) 64 | return GConsts.IND_UNDEFINED; 65 | numCont+=component.NumKnot; 66 | if (pozCont 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.21022 7 | 2.0 8 | {AC20D60C-02EB-4733-8333-222B0C45A0C4} 9 | Exe 10 | Properties 11 | GenerateFValData 12 | GenerateFValData 13 | v4.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 3.5 37 | 38 | 39 | 3.5 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 87 | 88 | GenerateFValData.exe 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /GenerateFValData/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("1.0.*")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified, the assembly is not signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 41 | // a key. 42 | // (*) If the KeyFile and the KeyName values are both specified, the 43 | // following processing occurs: 44 | // (1) If the KeyName can be found in the CSP, that key is used. 45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 46 | // in the KeyFile is installed into the CSP and used. 47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 48 | // When specifying the KeyFile, the location of the KeyFile should be 49 | // relative to the project output directory which is 50 | // %Project Directory%\obj\. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /GenerateFValData/help-proj-postamble.txt: -------------------------------------------------------------------------------- 1 | 2 | [INFOTYPES] 3 | -------------------------------------------------------------------------------- /GenerateFValData/help-proj-preamble.txt: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Auto Index=Yes 3 | Binary TOC=Yes 4 | Compatibility=1.1 or later 5 | Compiled file=FontValidatorHelp.chm 6 | Contents file=Table of Contents.hhc 7 | Default Window=Search 8 | Default topic=usingvalidator.htm 9 | Display compile progress=Yes 10 | Full-text search=Yes 11 | Index file=Index.hhk 12 | Language=0x409 English (United States) 13 | 14 | [WINDOWS] 15 | Search="Font Validator Help","Table of Contents.hhc","Index.hhk","usingvalidator.htm",,,,,,0x62520,,0x200e,[300,30,1000,530],,,,,,,0 16 | 17 | 18 | [FILES] 19 | interpretinglog.htm 20 | introtofv.htm 21 | legacy.htm 22 | resources.htm 23 | tooloverview.htm 24 | usingvalidator.htm 25 | -------------------------------------------------------------------------------- /GenerateFValData/helpitems.xsd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /GenerateFValData/interpretinglog.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Interpreting the Validation Report 6 | 7 | 8 | 9 |

Interpreting the Validation Report 10 |
11 |

12 |

13 |

The Font Validator generates Pass messages, Errors messages, Warnings, and Informational notes.

14 | Pass
15 | A Pass message indicates that the font has passed a specific test, as indicated by the text of the message.

16 | Errors
17 | Errors indicate that there is a structural or functional problem with the font. The file may be corrupted or have been built in a way that will cause problems and unexpected behavior for font clients.

18 | Warnings
19 | The Validator generates Warnings when something is found in the font that is inconsistent with Microsoft recommendations or may potentially cause problems. Issues labelled as Warnings may not prevent the font from working with current or previous Windows operating systems, but may compromise the usefulness of the font in the future.

20 | Information
21 | Informational notes identify which tables were not chosen for testing; and flag minor issues or inconsistencies.


22 | 23 | -------------------------------------------------------------------------------- /GenerateFValData/introtofv.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Introduction to Font Validator 6 | 7 | 8 |

Introduction to the Font Validator 9 |
10 |

11 |

12 | 13 |

The Font Validator is a tool that evaluates how closely a TrueType or OpenType font adheres to the current font format specification, as well as whether the font meets basic recommendations and deliverable guidelines from Microsoft. The Font Validator can be useful to developers creating or modifying fonts, or to developers who are creating tools to generate valid fonts. The Validator performs tests of 'static' data as well as tests for run-time errors.

14 |

The Validator identifies errors in a font by evaluating the font file and its component tables for their structural adherence to the spec, as well as for encoding inconsistencies within the font, errors with glyph contours, and out-of-range and unlikely values. The Validator checks for run-time errors (invalid instructions, stack overflow, IF without ENDIF, etc.) by rasterizing glyphs.

15 |

The Validator generates 'Errors' when a problem is found that may cause the font to either function in an unexpected fashion, or to not function at all. The Validator generates 'Warnings' when something is found in the font that is inconsistent with Microsoft recommendations or may potentially cause problems. Issues labelled as 'Warnings' may not prevent the font from working with current or previous Windows operating systems, but may compromise the usefulness of the font in the future. For more information on the types of information reported by the Font Validator, see Interpreting the Validation Report.

16 | 17 | -------------------------------------------------------------------------------- /GenerateFValData/legacy.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Information about Legacy Fonts 6 | 7 | 8 |

Information about Legacy Fonts 9 |
10 |

11 |

12 | 13 |

As noted, the Font Validator is a tool that evaluates how closely a TrueType or OpenType font adheres to the current OpenType font format specification and recommendations. Over the years, Microsoft (working with Apple and Adobe) has expanded and refined the font specification and issued more stringent recommendations with the following goals:

  • improving the quality of fonts
  • enhancing functionality and security
  • improving compatibility across operating systems
  • promoting consistent rendering and positioning operations in applications
14 | Some of the types of errors and warnings that you may see when legacy fonts are validated include the following:

Metric Data - Previous versions of the Microsoft TrueType rasterizer have differed from the current version in how they calculate metric data (i.e., character widths). To prevent text from reflowing in existing documentation, the old metric values may have been intentionally left in the font.

Outline Data - Problems with less sophisticated versions of development tools have allowed some outlines to be represented inefficiently and with ambiguity. Current outline editing tools do a more thorough job of validating outlines as they are created.

International Support - The OpenType format has formalized the way advanced typographic data is represented within fonts. Previously, international encoding and support has been handled in a variety of ways, some proprietary to applications. Although existing fonts may continue to work well, Microsoft encourages font developers to create fonts that more robustly support international typography and advanced layout operations. 15 | 16 | -------------------------------------------------------------------------------- /GenerateFValData/resources.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Introduction to Font Validator 6 | 7 | 8 |

Introduction to the Font Validator 9 |
10 |

11 |

12 | 13 |

The Font Validator is a tool that evaluates how closely a TrueType or OpenType font adheres to the current font format specification, as well as whether the font meets basic recommendations and deliverable guidelines from Microsoft. The Font Validator can be useful to developers creating or modifying fonts, or to developers who are creating tools to generate valid fonts. The Validator performs tests of 'static' data as well as tests for run-time errors.

14 |

The Validator identifies errors in a font by evaluating the font file and its component tables for their structural adherence to the spec, as well as for encoding inconsistencies within the font, errors with glyph contours, and out-of-range and unlikely values. The Validator checks for run-time errors (invalid instructions, stack overflow, IF without ENDIF, etc.) by rasterizing glyphs.

15 |

The Validator generates 'Errors' when a problem is found that may cause the font to either function in an unexpected fashion, or to not function at all. The Validator generates 'Warnings' when something is found in the font that is inconsistent with Microsoft recommendations. These inconsistencies may not prevent the font from working with current or previous Windows operating systems, but may compromise the usefulness of the font in the future. For more information on the types of information reported by the Font Validator, see Interpreting the Validation Log.

16 | 17 | 18 | -------------------------------------------------------------------------------- /GenerateFValData/startbutton.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/GenerateFValData/startbutton.jpg -------------------------------------------------------------------------------- /GenerateFValData/template-contents.txt: -------------------------------------------------------------------------------- 1 |
  • 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GenerateFValData/template.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ##HELPID## 6 | 7 | 8 | 9 | 10 | 11 | 12 |

    Message: ##HELPID##

    13 |
    14 |

    ##TABLENAME##: ##SHORTDESC##

    15 |

    ##PROBLEM##

    16 |

    For more information, see the ##LINKTITLE##. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /GenerateFValData/toc-error-postamble.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /GenerateFValData/toc-error-preamble.txt: -------------------------------------------------------------------------------- 1 |

  • 2 | 3 | 4 |
      5 | -------------------------------------------------------------------------------- /GenerateFValData/toc-info-postamble.txt: -------------------------------------------------------------------------------- 1 |
    2 | -------------------------------------------------------------------------------- /GenerateFValData/toc-info-preamble.txt: -------------------------------------------------------------------------------- 1 |
  • 2 | 3 | 4 |
      5 | -------------------------------------------------------------------------------- /GenerateFValData/toc-postamble.txt: -------------------------------------------------------------------------------- 1 |
    2 | 3 | -------------------------------------------------------------------------------- /GenerateFValData/toc-preamble.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
      11 |
    • 12 | 13 | 14 |
        15 |
      • 16 | 17 | 18 | 19 |
      • 20 | 21 | 22 | 23 |
      • 24 | 25 | 26 | 27 |
      • 28 | 29 | 30 | 31 |
      • 32 | 33 | 34 | 35 |
      36 | -------------------------------------------------------------------------------- /GenerateFValData/toc-warning-postamble.txt: -------------------------------------------------------------------------------- 1 |
    2 | -------------------------------------------------------------------------------- /GenerateFValData/toc-warning-preamble.txt: -------------------------------------------------------------------------------- 1 |
  • 2 | 3 | 4 |
      5 | -------------------------------------------------------------------------------- /GenerateFValData/tooloverview.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Font Tools 6 | 7 | 8 | 9 |

      Font Tools 10 |
      11 |

      12 |

      13 |

      Many tools exist for developing fonts. Some of these tools incorporate several functions, while others handle very specific tasks. Some of the functions these tools perform are: 14 |

        15 |
      • Creating and editing outlines
      • 16 |
      • Troubleshooting outlines
      • 17 |
      • Hinting outlines
      • 18 |
      • Converting font data
      • 19 |
      • Editing table data
      • 20 |
      • Adding tables
      • 21 |
      • Dumping font data
      • 22 |
      • Editing and inserting bitmaps
      • 23 |
      • Adding OpenType Layout data
      • 24 |
      • Creating TrueType Collection (TTC) Files
      • 25 |
      • Reordering font tables
      • 26 |
      • Optimizing font data
      • 27 |
      • Digitally signing fonts
      • 28 |
      • Proofing
      • 29 |
      30 | Microsoft recommends that font developers use tools that create fonts adhering to the OpenType specification, but Microsoft does not endorse specific tools. One of the best sources of information about current tools and their features is through a developer/user community, such as comp.fonts.

      31 | For more information about tools and resources available to font developers, see the Developer Information portion of the Microsoft Typography web site. 32 | 33 | 34 | -------------------------------------------------------------------------------- /GenerateFValData/usingvalidator.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Using Validator 6 | 7 | 8 |

      Using the Font Validator 9 |
      10 |

      11 |

      12 |

      Follow the steps below to test your fonts with the Font Validator.

      13 |
      1. Add Fonts
      2. 14 |
          15 |
        • Click the Font File tab.
        • 16 |
        • Drag and drop the files into the file list, or click the Add button to select files.
        • 17 |
        18 |
        19 |
      3. Select Tests
      4. 20 |
          21 |
        • Click the Table Tests tab to specify tables.
        • 22 |
        • Click the Rasterization tab to specify parameters.
        • 23 |
        • Select Validation/Report Options on the menu bar to specify reporting options.
        • 24 |
        25 |
        26 |
      5. Start Validation

      6. 27 |
        • Click the button.
        28 |
      29 | 30 | -------------------------------------------------------------------------------- /GenerateFValData/valstrings-postamble.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Glyph/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("1.0.*")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified, the assembly is not signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 41 | // a key. 42 | // (*) If the KeyFile and the KeyName values are both specified, the 43 | // following processing occurs: 44 | // (1) If the KeyName can be found in the CSP, that key is used. 45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 46 | // in the KeyFile is installed into the CSP and used. 47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 48 | // When specifying the KeyFile, the location of the KeyFile should be 49 | // relative to the project output directory which is 50 | // %Project Directory%\obj\. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /Glyph/DIWrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NS_ValCommon; 3 | 4 | namespace NS_Glyph 5 | { 6 | public delegate GErr DIWrapper(ValInfoBasic viBasic); 7 | } -------------------------------------------------------------------------------- /Glyph/DefsGC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NS_Glyph 4 | { 5 | public class DefsGC 6 | { 7 | public enum TypeGC 8 | { 9 | Invalid=-1, 10 | 11 | CorrectSimpMisorCont 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Glyph/DefsGM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NS_Glyph 4 | { 5 | public class DefsGM 6 | { 7 | public enum TypeGM 8 | { 9 | Invalid=-1, 10 | 11 | // validators 12 | ValidateTypeGlyphSource, 13 | ValidateSimpSource, 14 | ValidateCompSource, 15 | ValidateCompBind, 16 | 17 | // correctors 18 | CorrectSimpMisorCont, 19 | 20 | // pure modifiers 21 | ModifyMoveKnot, 22 | ModifyDeleteKnot 23 | } 24 | 25 | public static bool IsSourceValidator(TypeGM typeGM) 26 | { 27 | return ((typeGM==TypeGM.ValidateSimpSource)|| 28 | (typeGM==TypeGM.ValidateCompSource)|| 29 | (typeGM==TypeGM.ValidateTypeGlyphSource)); 30 | } 31 | public static bool IsValidator(TypeGM typeGM) 32 | { 33 | return (Enum.GetName(typeof(TypeGM),typeGM).StartsWith("Validate")); 34 | } 35 | public static bool IsCorrector(TypeGM typeGM) 36 | { 37 | return (Enum.GetName(typeof(TypeGM),typeGM).StartsWith("Correct")); 38 | } 39 | public static TypeGM From(DefsGV.TypeGV typeGV) 40 | { 41 | string strTypeGV=Enum.GetName(typeof(DefsGV.TypeGV),typeGV); 42 | object obj; 43 | try 44 | { 45 | obj=Enum.Parse(typeof(DefsGM.TypeGM),strTypeGV); 46 | } 47 | catch 48 | { 49 | return DefsGM.TypeGM.Invalid; 50 | } 51 | return (DefsGM.TypeGM)obj; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Glyph/ExceptionGlyph.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace NS_Glyph 5 | { 6 | public class ExceptionGlyph : System.Exception 7 | { 8 | /* 9 | * CONSTRUCTORS 10 | */ 11 | string strMessage; 12 | 13 | private ExceptionGlyph() 14 | { 15 | } 16 | public ExceptionGlyph(string nameClass, string nameMethod, string strDetails) 17 | { 18 | StringBuilder sb=new StringBuilder("Exception Glyph:"); 19 | if (nameClass!=null) 20 | { 21 | sb.Append(" class: "+nameClass); 22 | } 23 | if (nameMethod!=null) 24 | { 25 | sb.Append(" method: "+nameMethod); 26 | } 27 | if (strDetails!=null) 28 | { 29 | sb.Append(" details: "+strDetails); 30 | } 31 | this.strMessage=sb.ToString(); 32 | } 33 | override public string Message 34 | { 35 | get { return this.strMessage; } 36 | } 37 | 38 | /* 39 | * PROPERTIES 40 | */ 41 | } 42 | } -------------------------------------------------------------------------------- /Glyph/Flags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Diagnostics; 4 | 5 | namespace NS_Glyph 6 | { 7 | public class Flags 8 | { 9 | // members 10 | protected Type typeEnum; 11 | protected Hashtable vals; 12 | 13 | // indexer 14 | virtual public bool this [object flag] 15 | { 16 | get 17 | { 18 | if (!Enum.IsDefined(typeEnum,flag)) 19 | { 20 | throw new ExceptionGlyph("Flags","indexer(get)",null); 21 | } 22 | return ((bool)this.vals[(int)flag]); 23 | } 24 | set 25 | { 26 | if (!Enum.IsDefined(typeEnum,flag)) 27 | { 28 | throw new ExceptionGlyph("Flags","indexer(set)",null); 29 | } 30 | this.vals[(int)flag]=value; 31 | } 32 | } 33 | 34 | 35 | // constructors 36 | private Flags() 37 | { 38 | } 39 | public Flags(Type typeEnum) 40 | { 41 | this.vals=new Hashtable(); 42 | this.typeEnum=typeEnum; 43 | this.SetAll(false); 44 | } 45 | // methods 46 | public void SetAll(bool val) 47 | { 48 | System.Array flags=Enum.GetValues(this.typeEnum); 49 | foreach (int flag in flags) 50 | { 51 | this.vals[flag]=val; 52 | } 53 | } 54 | public void Clear() 55 | { 56 | this.vals.Clear(); 57 | } 58 | 59 | public bool AreAll(bool val) 60 | { 61 | System.Array flags=Enum.GetValues(this.typeEnum); 62 | foreach (int flag in flags) 63 | { 64 | if ((bool)(this.vals[flag])!=val) 65 | return false; 66 | } 67 | return true; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Glyph/FlagsGV.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace NS_Glyph 5 | { 6 | public class FlagsGV : Flags 7 | { 8 | /* 9 | * CONSTRUCTORS 10 | */ 11 | 12 | public FlagsGV(): base(typeof(DefsGV.TypeGV)) 13 | { 14 | this.SetAll(false); 15 | } 16 | 17 | // indexer 18 | override public bool this [object flag] 19 | { 20 | get 21 | { 22 | if (!Enum.IsDefined(typeof(DefsGV.TypeGV),flag)) 23 | { 24 | throw new ExceptionGlyph("FlagsGV","indexer(get)",null); 25 | } 26 | return ((bool)this.vals[(int)flag]); 27 | } 28 | set 29 | { 30 | if (!Enum.IsDefined(typeof(DefsGV.TypeGV),flag)) 31 | { 32 | throw new ExceptionGlyph("FlagsGV","indexer(set)",null); 33 | } 34 | DefsGV.TypeGV typeGV=(DefsGV.TypeGV)flag; 35 | if (value==true) 36 | { 37 | this.vals[(int)typeGV]=true; 38 | DefsGV.TypeGV[] typesPreRequired=DefsGV.GetTestsPreRequired(typeGV); 39 | if (typesPreRequired!=null) 40 | { 41 | foreach (DefsGV.TypeGV typePreRequired in typesPreRequired) 42 | this.vals[(int)typePreRequired]=true; 43 | } 44 | } 45 | else 46 | { 47 | this.vals[(int)typeGV]=false; 48 | DefsGV.TypeGV[] typesDependent=DefsGV.GetTestsDependent(typeGV); 49 | if (typesDependent!=null) 50 | { 51 | foreach (DefsGV.TypeGV typeDependent in typesDependent) 52 | this.vals[(int)typeDependent]=false; 53 | } 54 | } 55 | } 56 | } 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /Glyph/GDrawParam.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using NS_IDraw; 4 | 5 | namespace NS_Glyph 6 | { 7 | public class DrawParamGErr : DrawParam 8 | { 9 | // members 10 | Glyph glyph; 11 | 12 | // properties 13 | internal Glyph G 14 | { 15 | get { return this.glyph; } 16 | } 17 | // constructors 18 | public DrawParamGErr(Glyph glyph) 19 | : base(null,0) 20 | { 21 | this.glyph=glyph; 22 | } 23 | // members 24 | override public void ClearRelease() 25 | { 26 | this.glyph=null; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Glyph/GErrConsts.cs: -------------------------------------------------------------------------------- 1 | namespace NS_Glyph 2 | { 3 | public abstract class GErrConsts 4 | { 5 | public const string FILE_RES_GERR_STRINGS="NS_Glyph.GErrStrings"; 6 | public const string ASM_RES_GERR_STRINGS="Glyph"; 7 | public const string FILE_RES_OTFFERR_STRINGS="OTFontFileVal.ValStrings"; 8 | public const string ASM_RES_OTFFERR_STRINGS="OTFontFileVal"; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Glyph/GErrFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | 5 | using NS_ValCommon; 6 | 7 | namespace NS_Glyph 8 | { 9 | public class GErrFile 10 | { 11 | // members 12 | private FileInfo infoFile; 13 | 14 | // constructors 15 | private GErrFile() 16 | { 17 | } 18 | 19 | public GErrFile(string nameFile) 20 | { 21 | this.infoFile=new FileInfo(nameFile); 22 | if (this.infoFile.Exists) 23 | { 24 | this.infoFile.Delete(); 25 | } 26 | this.infoFile=new FileInfo(nameFile); 27 | StreamWriter writer=this.infoFile.AppendText(); 28 | writer.WriteLine(""); 29 | writer.Close(); 30 | } 31 | 32 | // methods 33 | public void DIAFunc_WriteToFile(ValInfoBasic info) 34 | { 35 | GErr gerr = info as GErr; 36 | // TODO: wrap 37 | 38 | if (gerr!=null) 39 | { 40 | string str=gerr.Write(); 41 | StreamWriter writer=this.infoFile.AppendText(); 42 | writer.WriteLine(str); 43 | writer.Close(); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Glyph/GErrSign.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | using System.Diagnostics; 5 | 6 | using NS_ValCommon; 7 | using NS_GMath; 8 | 9 | namespace NS_Glyph 10 | { 11 | public abstract class GErrSign 12 | { 13 | 14 | static public void Sign(GErr gerr, DefsGV.TypeGV typeGV, params int[] indsGlyph) 15 | { 16 | if (gerr==null) 17 | { 18 | throw new ExceptionGlyph("GErrSign","Sign","NullArgument"); 19 | } 20 | StringBuilder sb=new StringBuilder(""); 21 | sb.Append(Enum.GetName(typeof(DefsGV.TypeGV),typeGV)); 22 | sb.Append("_"); 23 | foreach (int indGlyph in indsGlyph) 24 | { 25 | sb.Append(indGlyph+"_"); 26 | } 27 | gerr.SignCreator=sb.ToString(); 28 | } 29 | 30 | static public void Sign(GErrList gerrlist, DefsGV.TypeGV typeGV, params int[] indsGlyph) 31 | { 32 | if (gerrlist==null) 33 | { 34 | throw new ExceptionGlyph("GErrSign","Sign","Null argument"); 35 | } 36 | foreach (GErr gerr in gerrlist) 37 | { 38 | Sign(gerr,typeGV,indsGlyph); 39 | } 40 | } 41 | 42 | static public bool DICFunc_IsSignedBy(ValInfoBasic info, DefsGV.TypeGV typeGV) 43 | { 44 | GErr gerr=info as GErr; 45 | if (gerr==null) 46 | { 47 | throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null); 48 | } 49 | string strSign=gerr.SignCreator; 50 | if (strSign==null) 51 | { 52 | throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null); 53 | } 54 | string strTypeGV=Enum.GetName(typeof(DefsGV.TypeGV),typeGV); 55 | return strSign.StartsWith(strTypeGV); 56 | } 57 | 58 | static public bool DICFunc_IsSignedBy(ValInfoBasic info, int indGlyph) 59 | { 60 | GErr gerr=info as GErr; 61 | if (gerr==null) 62 | { 63 | throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null); 64 | } 65 | string strSign=gerr.SignCreator; 66 | if (strSign==null) 67 | { 68 | throw new ExceptionGlyph("GErrSign","DICFunc_IsSignedBy",null); 69 | } 70 | string strGlyph="_"+indGlyph+"_"; 71 | return (strSign.IndexOf(strGlyph)!=GConsts.POZ_INVALID); 72 | } 73 | 74 | 75 | static public void Parse(GErr gerr, 76 | out DefsGV.TypeGV typeGV, out int[] indsGlyph) 77 | { 78 | typeGV=DefsGV.TypeGV.Invalid; 79 | indsGlyph=null; 80 | string strSign=gerr.SignCreator; 81 | if (strSign==null) 82 | { 83 | throw new ExceptionGlyph("GErrSign","Parse",null); 84 | } 85 | string[] strs=strSign.Split('_'); 86 | if (strs.Length<1) 87 | { 88 | throw new ExceptionGlyph("GErrSign","Parse",null); 89 | } 90 | typeGV=(DefsGV.TypeGV)Enum.Parse(typeof(DefsGV.TypeGV),strs[0]); 91 | if ((strs.Length)>1) 92 | { 93 | indsGlyph=new int[strs.Length-1]; 94 | } 95 | for (int iInd=1; iInd. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /OTFontFile/ClassDiagram1.cd: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OTFontFile/ClassDiagram2.cd: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OTFontFile/OTTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections; 4 | using System.Diagnostics; 5 | 6 | 7 | 8 | 9 | namespace OTFontFile 10 | { 11 | abstract public class OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | /// Construct abstract base class tag and buffer 19 | public OTTable(OTTag tag, MBOBuffer buf) 20 | { 21 | m_tag = new OTTag(tag); 22 | m_bufTable = buf; 23 | } 24 | 25 | 26 | /************************ 27 | * public methods 28 | */ 29 | 30 | 31 | /// Calculate checksum for all except for 'head' 32 | public virtual uint CalcChecksum() 33 | { 34 | // NOTE: this method gets overridden by the head table class 35 | 36 | return m_bufTable.CalcChecksum(); 37 | } 38 | 39 | /// Accessor of m_bufTable 40 | public MBOBuffer GetBuffer() 41 | { 42 | return m_bufTable; 43 | } 44 | 45 | /// Return true iff offset is at the same 46 | /// m_bufTable.GetFilePos(), and length is equal to 47 | /// m_bufTable.GetLength(). 48 | /// 49 | public bool MatchFileOffsetLength(uint offset, uint length) 50 | { 51 | bool bRet = true; 52 | 53 | if (m_bufTable == null) 54 | { 55 | bRet = false; 56 | } 57 | else 58 | { 59 | if (offset != (uint)m_bufTable.GetFilePos()) 60 | { 61 | bRet = false; 62 | } 63 | if (length != m_bufTable.GetLength()) 64 | { 65 | bRet = false; 66 | } 67 | } 68 | 69 | return bRet; 70 | } 71 | 72 | /// Return true iff de is for a 73 | /// DirectoryEntry for a table equal to this one in 74 | /// tag, checksum, file offset and length. 75 | /// 76 | public bool MatchDirectoryEntry(DirectoryEntry de) 77 | { 78 | bool bRet = true; 79 | 80 | if (de.tag != m_tag) 81 | { 82 | bRet = false; 83 | } 84 | 85 | if (de.checkSum != CalcChecksum()) 86 | { 87 | bRet = false; 88 | } 89 | 90 | if (!MatchFileOffsetLength(de.offset, de.length)) 91 | { 92 | bRet = false; 93 | } 94 | 95 | return bRet; 96 | } 97 | 98 | /// Return length of m_bufTable or 0, if none. 99 | public uint GetLength() 100 | { 101 | uint nLength = 0; 102 | 103 | if (m_bufTable != null) 104 | { 105 | nLength = m_bufTable.GetLength(); 106 | } 107 | 108 | return nLength; 109 | } 110 | 111 | /// Accessor for m_tag 112 | public OTTag GetTag() 113 | { 114 | return m_tag; 115 | } 116 | 117 | 118 | /************************ 119 | * nested class for 120 | * holding cached data 121 | */ 122 | 123 | public abstract class DataCache 124 | { 125 | public DataCache() 126 | { 127 | m_bDirty = false; 128 | } 129 | 130 | public bool IsDirty() 131 | { 132 | return m_bDirty; 133 | } 134 | 135 | public abstract OTTable GenerateTable(); 136 | protected bool m_bDirty; 137 | } 138 | 139 | /// 140 | /// derived classes should override this method to 141 | /// create their cache on demand 142 | /// 143 | public virtual DataCache GetCache() 144 | { 145 | return m_cache; 146 | } 147 | 148 | 149 | /************************ 150 | * member data 151 | */ 152 | 153 | public MBOBuffer m_bufTable; 154 | public OTTag m_tag; 155 | protected DataCache m_cache; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /OTFontFile/TTCHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | 5 | 6 | 7 | namespace OTFontFile 8 | { 9 | /// 10 | /// Summary description for TTCHeader. 11 | /// 12 | public class TTCHeader 13 | { 14 | /*************** 15 | * constructors 16 | */ 17 | public TTCHeader() 18 | { 19 | DirectoryOffsets = new System.Collections.ArrayList(); 20 | } 21 | 22 | /************************ 23 | * public static methods 24 | */ 25 | public static TTCHeader ReadTTCHeader(OTFile file) 26 | { 27 | TTCHeader ttc = null; 28 | 29 | const int SIZEOF_FIRSTTHREEFIELDS = 12; 30 | const int SIZEOF_UINT = 4; 31 | 32 | // read the first three fields of the TTC Header 33 | // starting at the beginning of the file 34 | 35 | MBOBuffer buf = file.ReadPaddedBuffer(0, SIZEOF_FIRSTTHREEFIELDS); 36 | 37 | OTTag tag = null; 38 | uint version = 0; 39 | uint DirectoryCount = 0; 40 | 41 | if (buf != null) 42 | { 43 | tag = new OTTag(buf.GetBuffer()); 44 | version = buf.GetUint(4); 45 | DirectoryCount = buf.GetUint(8); 46 | } 47 | 48 | 49 | // if the tag and the version and the dir count seem correct then 50 | // allocate a TTCHeader object and try to read the rest of the header 51 | if ((string)tag == "ttcf" && 52 | (version == 0x00010000 || version == 0x00020000) && 53 | 12 + DirectoryCount * SIZEOF_UINT < file.GetFileLength()) 54 | { 55 | ttc = new TTCHeader(); 56 | ttc.TTCTag = tag; 57 | ttc.version = version; 58 | ttc.DirectoryCount = DirectoryCount; 59 | 60 | // Directory offsets 61 | buf = file.ReadPaddedBuffer(SIZEOF_FIRSTTHREEFIELDS, DirectoryCount*SIZEOF_UINT); 62 | if (buf != null) 63 | { 64 | for (uint i=0; i 9 | /// Summary description for Table_CFF. 10 | /// 11 | public class Table_CFF : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table_CFF(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | /************************ 24 | * field offset values 25 | */ 26 | 27 | public enum FieldOffsets 28 | { 29 | major = 0, 30 | minor = 1, 31 | hdrSize = 2, 32 | offSize = 3 33 | } 34 | 35 | 36 | /************************ 37 | * accessors 38 | */ 39 | 40 | public byte major 41 | { 42 | get {return m_bufTable.GetByte((uint)FieldOffsets.major);} 43 | } 44 | 45 | public byte minor 46 | { 47 | get {return m_bufTable.GetByte((uint)FieldOffsets.minor);} 48 | } 49 | 50 | public byte hdrSize 51 | { 52 | get {return m_bufTable.GetByte((uint)FieldOffsets.hdrSize);} 53 | } 54 | 55 | public byte offSize 56 | { 57 | get {return m_bufTable.GetByte((uint)FieldOffsets.offSize);} 58 | } 59 | 60 | 61 | 62 | /************************ 63 | * DataCache class 64 | */ 65 | 66 | public override DataCache GetCache() 67 | { 68 | if (m_cache == null) 69 | { 70 | m_cache = new CFF_cache(); 71 | } 72 | 73 | return m_cache; 74 | } 75 | 76 | public class CFF_cache : DataCache 77 | { 78 | public override OTTable GenerateTable() 79 | { 80 | // not yet implemented! 81 | return null; 82 | } 83 | } 84 | 85 | 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /OTFontFile/Table_DSIG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | 5 | 6 | 7 | namespace OTFontFile 8 | { 9 | /// 10 | /// Summary description for Table_DSIG. 11 | /// 12 | public class Table_DSIG : OTTable 13 | { 14 | /************************ 15 | * constructors 16 | */ 17 | 18 | 19 | public Table_DSIG(OTTag tag, MBOBuffer buf) : base(tag, buf) 20 | { 21 | } 22 | 23 | /************************ 24 | * field offset values 25 | */ 26 | 27 | 28 | public enum FieldOffsets 29 | { 30 | ulVersion = 0, 31 | usNumSigs = 4, 32 | usFlag = 6, 33 | } 34 | 35 | 36 | /************************ 37 | * public methods 38 | */ 39 | 40 | 41 | 42 | /************************ 43 | * internal classes 44 | */ 45 | 46 | public class SigFormatOffset 47 | { 48 | public uint ulFormat; 49 | public uint ulLength; 50 | public uint ulOffset; 51 | } 52 | 53 | public class SignatureBlock 54 | { 55 | public ushort usReserved1; 56 | public ushort usReserved2; 57 | public uint cbSignature; 58 | public byte[] bSignature; 59 | } 60 | 61 | /************************ 62 | * accessors 63 | */ 64 | 65 | 66 | public uint ulVersion 67 | { 68 | get {return m_bufTable.GetUint((uint)FieldOffsets.ulVersion);} 69 | } 70 | 71 | public ushort usNumSigs 72 | { 73 | get {return m_bufTable.GetUshort((uint)FieldOffsets.usNumSigs);} 74 | } 75 | 76 | public ushort usFlag 77 | { 78 | get {return m_bufTable.GetUshort((uint)FieldOffsets.usFlag);} 79 | } 80 | 81 | public SigFormatOffset GetSigFormatOffset(uint i) 82 | { 83 | SigFormatOffset sfo = null; 84 | 85 | if (i < usNumSigs) 86 | { 87 | sfo = new SigFormatOffset(); 88 | uint offset = 8 + i * 12; 89 | sfo.ulFormat = m_bufTable.GetUint(offset); 90 | sfo.ulLength = m_bufTable.GetUint(offset + 4); 91 | sfo.ulOffset = m_bufTable.GetUint(offset + 8); 92 | } 93 | 94 | return sfo; 95 | } 96 | 97 | public SignatureBlock GetSignatureBlock(uint i) 98 | { 99 | SignatureBlock sb = null; 100 | 101 | if (i < usNumSigs) 102 | { 103 | SigFormatOffset sfo = GetSigFormatOffset(i); 104 | 105 | sb = new SignatureBlock(); 106 | sb.usReserved1 = m_bufTable.GetUshort(sfo.ulOffset); 107 | sb.usReserved2 = m_bufTable.GetUshort(sfo.ulOffset + 2); 108 | sb.cbSignature = m_bufTable.GetUint(sfo.ulOffset + 4); 109 | sb.bSignature = new byte[sb.cbSignature]; 110 | System.Buffer.BlockCopy(m_bufTable.GetBuffer(), (int)sfo.ulOffset + 8, sb.bSignature, 0, (int)sb.cbSignature); 111 | } 112 | 113 | return sb; 114 | } 115 | 116 | 117 | /************************ 118 | * DataCache class 119 | */ 120 | 121 | public override DataCache GetCache() 122 | { 123 | if (m_cache == null) 124 | { 125 | m_cache = new DSIG_cache(); 126 | } 127 | 128 | return m_cache; 129 | } 130 | 131 | public class DSIG_cache : DataCache 132 | { 133 | public override OTTable GenerateTable() 134 | { 135 | // not yet implemented! 136 | return null; 137 | } 138 | } 139 | 140 | 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /OTFontFile/Table_VORG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | 6 | namespace OTFontFile 7 | { 8 | /// 9 | /// Summary description for Table_VORG. 10 | /// 11 | public class Table_VORG : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table_VORG(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | /************************ 23 | * field offset values 24 | */ 25 | 26 | 27 | public enum FieldOffsets 28 | { 29 | majorVersion = 0, 30 | minorVersion = 2, 31 | defaultVertOriginY = 4, 32 | numVertOriginYMetrics = 6, 33 | StartOfArray = 8 34 | } 35 | 36 | 37 | /************************ 38 | * internal classes 39 | */ 40 | 41 | public class vertOriginYMetrics 42 | { 43 | public ushort glyphIndex; 44 | public short vertOriginY; 45 | } 46 | 47 | 48 | /************************ 49 | * accessors 50 | */ 51 | 52 | public ushort majorVersion 53 | { 54 | get {return m_bufTable.GetUshort((uint)FieldOffsets.majorVersion);} 55 | } 56 | 57 | public ushort minorVersion 58 | { 59 | get {return m_bufTable.GetUshort((uint)FieldOffsets.minorVersion);} 60 | } 61 | 62 | public short defaultVertOriginY 63 | { 64 | get {return m_bufTable.GetShort((uint)FieldOffsets.defaultVertOriginY);} 65 | } 66 | 67 | public ushort numVertOriginYMetrics 68 | { 69 | get {return m_bufTable.GetUshort((uint)FieldOffsets.numVertOriginYMetrics);} 70 | } 71 | 72 | public vertOriginYMetrics GetVertOriginYMetrics(uint i) 73 | { 74 | vertOriginYMetrics voym = null; 75 | 76 | if (i < numVertOriginYMetrics) 77 | { 78 | voym = new vertOriginYMetrics(); 79 | 80 | voym.glyphIndex = m_bufTable.GetUshort((uint)FieldOffsets.StartOfArray + i*4); 81 | voym.vertOriginY = m_bufTable.GetShort((uint)FieldOffsets.StartOfArray + i*4 + 2); 82 | } 83 | 84 | return voym; 85 | } 86 | 87 | 88 | /************************ 89 | * DataCache class 90 | */ 91 | 92 | public override DataCache GetCache() 93 | { 94 | if (m_cache == null) 95 | { 96 | m_cache = new VORG_cache(); 97 | } 98 | 99 | return m_cache; 100 | } 101 | 102 | public class VORG_cache : DataCache 103 | { 104 | public override OTTable GenerateTable() 105 | { 106 | // not yet implemented! 107 | return null; 108 | } 109 | } 110 | 111 | 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /OTFontFile/Table__Unknown.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | 6 | namespace OTFontFile 7 | { 8 | /// 9 | /// Summary description for Table__Unknown. 10 | /// 11 | public class Table__Unknown : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table__Unknown(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /OTFontFile/Table_cvt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | 6 | namespace OTFontFile 7 | { 8 | /// 9 | /// Summary description for Table_cvt. 10 | /// 11 | public class Table_cvt : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table_cvt(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public short GetValue(uint i) 28 | { 29 | return m_bufTable.GetShort(i*2); 30 | } 31 | 32 | 33 | 34 | /************************ 35 | * DataCache class 36 | */ 37 | 38 | public override DataCache GetCache() 39 | { 40 | if (m_cache == null) 41 | { 42 | m_cache = new cvt_cache(); 43 | } 44 | 45 | return m_cache; 46 | } 47 | 48 | public class cvt_cache : DataCache 49 | { 50 | public override OTTable GenerateTable() 51 | { 52 | // not yet implemented! 53 | return null; 54 | } 55 | } 56 | 57 | 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /OTFontFile/Table_fpgm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | 6 | namespace OTFontFile 7 | { 8 | /// 9 | /// Summary description for Table_fpgm. 10 | /// 11 | public class Table_fpgm : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table_fpgm(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | /************************ 24 | * public methods 25 | */ 26 | 27 | 28 | public byte GetByte(uint i) 29 | { 30 | return m_bufTable.GetByte(i); 31 | } 32 | 33 | 34 | /************************ 35 | * DataCache class 36 | */ 37 | 38 | public override DataCache GetCache() 39 | { 40 | if (m_cache == null) 41 | { 42 | m_cache = new fpgm_cache(); 43 | } 44 | 45 | return m_cache; 46 | } 47 | 48 | public class fpgm_cache : DataCache 49 | { 50 | public override OTTable GenerateTable() 51 | { 52 | // not yet implemented! 53 | return null; 54 | } 55 | } 56 | 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /OTFontFile/Table_prep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | 5 | 6 | namespace OTFontFile 7 | { 8 | /// 9 | /// Summary description for Table_prep. 10 | /// 11 | public class Table_prep : OTTable 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public Table_prep(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | /************************ 24 | * accessors 25 | */ 26 | 27 | 28 | public byte GetByte(uint i) 29 | { 30 | return m_bufTable.GetByte(i); 31 | } 32 | 33 | 34 | /************************ 35 | * DataCache class 36 | */ 37 | 38 | public override DataCache GetCache() 39 | { 40 | if (m_cache == null) 41 | { 42 | m_cache = new prep_cache(); 43 | } 44 | 45 | return m_cache; 46 | } 47 | 48 | public class prep_cache : DataCache 49 | { 50 | public override OTTable GenerateTable() 51 | { 52 | // not yet implemented! 53 | return null; 54 | } 55 | } 56 | 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /OTFontFile/util.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections; 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | 7 | 8 | namespace OTFontFile 9 | { 10 | public class util 11 | { 12 | public static ushort MaxPower2LE(ushort n) 13 | { 14 | // returns max power of 2 <= n 15 | 16 | if (n == 0) 17 | { 18 | throw new ArithmeticException(); 19 | } 20 | 21 | ushort pow2 = 1; 22 | n >>= 1; 23 | while (n != 0) 24 | { 25 | n >>= 1; 26 | pow2 <<= 1; 27 | } 28 | 29 | return pow2; 30 | } 31 | 32 | public static ushort Log2(ushort n) 33 | { 34 | // returns the integer component of log2 of n 35 | // fractional component is lost, but not needed by font spec 36 | 37 | if (n == 0) 38 | { 39 | throw new ArithmeticException(); 40 | } 41 | 42 | ushort log2 = 0; 43 | n >>= 1; 44 | 45 | while (n != 0) 46 | { 47 | n >>= 1; 48 | log2++; 49 | } 50 | 51 | return log2; 52 | } 53 | 54 | } 55 | 56 | // The purpose of this class is to allow an ArrayList with a deep copy clone method 57 | // Any object that is part of this ArryList needs to support ICloneable 58 | public class DeepCloneArrayList : ArrayList 59 | { 60 | public override object Clone() 61 | { 62 | DeepCloneArrayList clonedList = new DeepCloneArrayList(); 63 | 64 | for( int i = 0; i < this.Count; i++ ) 65 | { 66 | clonedList.Add( ((ICloneable)this[i]).Clone() ); 67 | 68 | } 69 | 70 | return clonedList; 71 | } 72 | 73 | } 74 | 75 | 76 | } 77 | -------------------------------------------------------------------------------- /OTFontFileVal/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("1.0.*")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified, the assembly is not signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 41 | // a key. 42 | // (*) If the KeyFile and the KeyName values are both specified, the 43 | // following processing occurs: 44 | // (1) If the KeyName can be found in the CSP, that key is used. 45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 46 | // in the KeyFile is installed into the CSP and used. 47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 48 | // When specifying the KeyFile, the location of the KeyFile should be 49 | // relative to the project output directory which is 50 | // %Project Directory%\obj\. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /OTFontFileVal/CallbVal.cs: -------------------------------------------------------------------------------- 1 | //Simple callback class for the Driver class 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.IO; 6 | using OTFontFile; 7 | 8 | namespace OTFontFileVal 9 | { 10 | public class CallbVal : Driver.DriverCallbacks{ 11 | 12 | public void OnBeginFontTest( String label, int nthFont, int nFonts ){ 13 | 14 | } 15 | public void OnBeginTableTest( DirectoryEntry de ){ 16 | 17 | } 18 | public void OnBeginRasterTest( String label ){ 19 | 20 | } 21 | public void OnTestProgress( Object obj ){ 22 | 23 | } 24 | public String GetReportFileName( String fname ){ 25 | String ret = fname + ".report.xml"; 26 | return ret; 27 | } 28 | public void OnOpenReportFile( String sReportFile, String fpath ){ 29 | 30 | } 31 | public void OnCloseReportFile( String sReportFile ){ 32 | Driver.CopyXslFile(sReportFile); 33 | } 34 | public void OnReportsReady(){ 35 | 36 | } 37 | public void OnCancel(){ 38 | 39 | } 40 | public void OnException( Exception e ){ 41 | if (e.GetType() == typeof(FileNotFoundException)) 42 | { 43 | FileNotFoundException fileex = (FileNotFoundException) e; 44 | Console.WriteLine("ERROR: Validation library incomplete. Aborting."); 45 | Console.WriteLine("Missing file: " + "\"" + fileex.FileName + "\""); 46 | } 47 | } 48 | public void OnOTFileValChange( OTFileVal fontFile ){ 49 | 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /OTFontFileVal/ClassDiagram2.cd: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OTFontFileVal/ITableValidate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | interface ITableValidate 8 | { 9 | bool Validate(Validator v, OTFontVal fontOwner); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OTFontFileVal/OTFontFileVal.ValStrings.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/OTFontFileVal/OTFontFileVal.ValStrings.resources -------------------------------------------------------------------------------- /OTFontFileVal/Overlap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace OTFontFileVal 5 | { 6 | /// 7 | /// Summary description for Overlap. 8 | /// 9 | public class DataOverlapDetector 10 | { 11 | public DataOverlapDetector() 12 | { 13 | m_listFootprints = new ArrayList(); 14 | } 15 | 16 | public bool CheckForNoOverlap(uint offset, uint length) 17 | { 18 | bool bNoOverlap = true; 19 | 20 | // create a new footprint object 21 | Footprint footprint = new Footprint(offset, length); 22 | 23 | // compare the current footprint against each stored footprint 24 | 25 | for (int i=0; i= f.first && first <= f.last) || (f.first >= first && f.first <= last) ) 59 | { 60 | bOverlap = true; 61 | } 62 | } 63 | 64 | return bOverlap; 65 | } 66 | 67 | uint first; 68 | uint last; 69 | uint length; 70 | } 71 | 72 | ArrayList m_listFootprints; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /OTFontFileVal/RastTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace OTFontFileVal 4 | { 5 | // transform class used for rasterization testing 6 | public class RastTestTransform 7 | { 8 | public RastTestTransform() 9 | { 10 | stretchX = 1.0f; 11 | stretchY = 1.0f; 12 | 13 | matrix = new float[3,3]; 14 | for (int i=0; i<3; i++) 15 | { 16 | matrix[i,i] = 1.0f; 17 | } 18 | } 19 | 20 | public float stretchX; 21 | public float stretchY; 22 | public float rotation; 23 | public float skew; 24 | public float [,] matrix; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /OTFontFileVal/TableManagerVal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | 6 | namespace OTFontFileVal 7 | { 8 | /// 9 | /// Summary description for TableManager. 10 | /// 11 | public class TableManagerVal : TableManager 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public TableManagerVal(OTFile file) : base(file) 19 | { 20 | 21 | } 22 | 23 | 24 | /************************ 25 | * public methods 26 | */ 27 | 28 | public override OTTable CreateTableObject(OTTag tag, MBOBuffer buf) 29 | { 30 | OTTable table = null; 31 | 32 | string sName = GetUnaliasedTableName(tag); 33 | 34 | switch (sName) 35 | { 36 | case "BASE": table = new val_BASE(tag, buf); break; 37 | case "CFF ": table = new val_CFF(tag, buf); break; 38 | case "cmap": table = new val_cmap(tag, buf); break; 39 | case "cvt ": table = new val_cvt(tag, buf); break; 40 | case "DSIG": table = new val_DSIG(tag, buf); break; 41 | case "EBDT": table = new val_EBDT(tag, buf); break; 42 | case "EBLC": table = new val_EBLC(tag, buf); break; 43 | case "EBSC": table = new val_EBSC(tag, buf); break; 44 | case "fpgm": table = new val_fpgm(tag, buf); break; 45 | case "gasp": table = new val_gasp(tag, buf); break; 46 | case "GDEF": table = new val_GDEF(tag, buf); break; 47 | case "glyf": table = new val_glyf(tag, buf); break; 48 | case "GPOS": table = new val_GPOS(tag, buf); break; 49 | case "GSUB": table = new val_GSUB(tag, buf); break; 50 | case "hdmx": table = new val_hdmx(tag, buf); break; 51 | case "head": table = new val_head(tag, buf); break; 52 | case "hhea": table = new val_hhea(tag, buf); break; 53 | case "hmtx": table = new val_hmtx(tag, buf); break; 54 | case "JSTF": table = new val_JSTF(tag, buf); break; 55 | case "kern": table = new val_kern(tag, buf); break; 56 | case "loca": table = new val_loca(tag, buf); break; 57 | case "LTSH": table = new val_LTSH(tag, buf); break; 58 | case "maxp": table = new val_maxp(tag, buf); break; 59 | case "name": table = new val_name(tag, buf); break; 60 | case "OS/2": table = new val_OS2(tag, buf); break; 61 | case "PCLT": table = new val_PCLT(tag, buf); break; 62 | case "post": table = new val_post(tag, buf); break; 63 | case "prep": table = new val_prep(tag, buf); break; 64 | case "VDMX": table = new val_VDMX(tag, buf); break; 65 | case "vhea": table = new val_vhea(tag, buf); break; 66 | case "vmtx": table = new val_vmtx(tag, buf); break; 67 | case "VORG": table = new val_VORG(tag, buf); break; 68 | //case "Zapf": table = new val_Zapf(tag, buf); break; 69 | 70 | default: table = new val__Unknown(tag, buf); break; 71 | } 72 | 73 | return table; 74 | } 75 | 76 | 77 | /************************ 78 | * protected methods 79 | */ 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /OTFontFileVal/ValidatorParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | using NS_ValCommon; 8 | using OTFontFile; 9 | 10 | namespace OTFontFileVal { 11 | 12 | /// 13 | /// Collect the parameters to the validator in a unified way. 14 | /// 15 | public class ValidatorParameters 16 | { 17 | private string [] m_allTables = TableManager.GetKnownOTTableTypes(); 18 | public List tablesToTest = new List(); 19 | public bool doRastBW = false; 20 | public bool doRastGray = false; 21 | public bool doRastClearType = false; 22 | public bool doRastCTCompWidth = false; 23 | public bool doRastCTVert = false; 24 | public bool doRastCTBGR = false; 25 | public bool doRastCTFractWidth = false; 26 | public int xRes = 96; 27 | public int yRes = 96; 28 | public RastTestTransform xform = new RastTestTransform(); // Later 29 | public List sizes = new List(); 30 | 31 | public ValidatorParameters() 32 | { 33 | SetAllTables(); 34 | SetDefaultSizes(); 35 | } 36 | 37 | public void SetNoRasterTesting() 38 | { 39 | doRastBW = false; 40 | doRastGray = false; 41 | doRastClearType = false; 42 | doRastCTCompWidth = false; 43 | doRastCTVert = false; 44 | doRastCTBGR = false; 45 | doRastCTFractWidth = false; 46 | } 47 | 48 | public void SetRasterTesting() 49 | { 50 | doRastBW = true; 51 | doRastGray = true; 52 | doRastClearType = true; 53 | doRastCTCompWidth = true; 54 | doRastCTVert = true; 55 | doRastCTBGR = true; 56 | doRastCTFractWidth = true; 57 | } 58 | 59 | private void SetDefaultSizes() 60 | { 61 | for ( int i = 4; i <= 72; i++ ) { 62 | sizes.Add( i ); 63 | } 64 | sizes.Add( 80 ); 65 | sizes.Add( 88 ); 66 | sizes.Add( 96 ); 67 | sizes.Add( 102 ); 68 | sizes.Add( 110 ); 69 | sizes.Add( 118 ); 70 | sizes.Add( 126 ); 71 | } 72 | 73 | public void AddTable( string table ) 74 | { 75 | if ( !tablesToTest.Contains( table ) ) { 76 | tablesToTest.Add( table ); 77 | } 78 | } 79 | 80 | public int RemoveTableFromList( string table ) 81 | { 82 | int i; 83 | for ( i = 0; tablesToTest.Remove( table ); i++ ); 84 | return i; 85 | } 86 | 87 | public void SetAllTables() 88 | { 89 | tablesToTest.Clear(); 90 | for ( int k = 0; k < m_allTables.Length; k++ ) { 91 | tablesToTest.Add( m_allTables[k] ); 92 | } 93 | } 94 | 95 | public void ClearTables() 96 | { 97 | tablesToTest.Clear(); 98 | } 99 | 100 | public void SetupValidator( Validator v ) 101 | { 102 | for ( int k = 0; k < m_allTables.Length; k++ ) { 103 | string table = m_allTables[k]; 104 | bool perform = tablesToTest.Contains( table ); 105 | v.SetTablePerformTest( table, perform ); 106 | } 107 | v.SetRastPerformTest( doRastBW, 108 | doRastGray, 109 | doRastClearType, 110 | doRastCTCompWidth, 111 | doRastCTVert, 112 | doRastCTBGR, 113 | doRastCTFractWidth ); 114 | v.SetRastTestParams( xRes, yRes, sizes.ToArray(), xform ); 115 | 116 | } 117 | } 118 | 119 | 120 | 121 | } -------------------------------------------------------------------------------- /OTFontFileVal/val_CFF.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_CFF. 9 | /// 10 | public class val_CFF : Table_CFF, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_CFF(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | public bool Validate(Validator v, OTFontVal fontOwner) 27 | { 28 | bool bRet = true; 29 | 30 | v.Info(T.T_NULL, I.CFF_I_Version, m_tag, major + "." + minor); 31 | v.Info(I.CFF_I_NotValidated, m_tag); 32 | 33 | return bRet; 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OTFontFileVal/val_DSIG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | using OTFontFile; 5 | using WinVerifyTrustAPI; 6 | 7 | namespace OTFontFileVal 8 | { 9 | /// 10 | /// Summary description for val_DSIG. 11 | /// 12 | public class val_DSIG : Table_DSIG, ITableValidate 13 | { 14 | /************************ 15 | * constructors 16 | */ 17 | 18 | 19 | public val_DSIG(OTTag tag, MBOBuffer buf) : base(tag, buf) 20 | { 21 | } 22 | 23 | /************************ 24 | * public methods 25 | */ 26 | 27 | 28 | public bool Validate(Validator v, OTFontVal fontOwner) 29 | { 30 | bool bRet = true; 31 | 32 | if (v.PerformTest(T.DSIG_Formats)) 33 | { 34 | bool bFormatsOk = true; 35 | for (uint i=0; i 8 | /// Summary description for val_EBSC. 9 | /// 10 | public class val_EBSC : Table_EBSC, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_EBSC(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public bool Validate(Validator v, OTFontVal fontOwner) 28 | { 29 | bool bRet = true; 30 | 31 | if (v.PerformTest(T.EBSC_version)) 32 | { 33 | if (version.GetUint() == 0x00020000) 34 | { 35 | v.Pass(T.EBSC_version, P.EBSC_P_version, m_tag); 36 | } 37 | else 38 | { 39 | v.Error(T.EBSC_version, E.EBSC_E_version, m_tag, "version = 0x" + version.GetUint().ToString("x8") + ", unable to continue validation"); 40 | return false; 41 | } 42 | } 43 | 44 | if (v.PerformTest(T.EBSC_TableLength)) 45 | { 46 | uint CalcLength = 8 + (numSizes * 28); 47 | if (CalcLength == GetLength()) 48 | { 49 | v.Pass(T.EBSC_TableLength, P.EBSC_P_TableLength, m_tag); 50 | } 51 | else 52 | { 53 | string s = "actual length = " + GetLength() + ", calculated = " + CalcLength; 54 | v.Error(T.EBSC_TableLength, E.EBSC_E_TableLength, m_tag, s); 55 | bRet = false; 56 | } 57 | } 58 | 59 | if (v.PerformTest(T.EBSC_TableDependency)) 60 | { 61 | Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); 62 | Table_EBDT EBDTTable = (Table_EBDT)fontOwner.GetTable("EBDT"); 63 | if ( EBLCTable != null 64 | && EBDTTable != null) 65 | { 66 | v.Pass(T.EBSC_TableDependency, P.EBSC_P_TableDependency, m_tag); 67 | } 68 | else 69 | { 70 | string s = "Missing: "; 71 | if (EBLCTable == null) 72 | { 73 | s = s + "EBLC"; 74 | } 75 | if (EBDTTable == null) 76 | { 77 | if (EBLCTable == null) 78 | s = s + ", EBDT"; 79 | else 80 | s = s + "EBDT"; 81 | } 82 | 83 | v.Error(T.EBSC_TableDependency, E.EBSC_E_TableDependency, m_tag, s); 84 | bRet = false; 85 | } 86 | } 87 | 88 | if (v.PerformTest("EBSC_StrikeSizes")) 89 | { 90 | Table_EBLC EBLCTable = (Table_EBLC)fontOwner.GetTable("EBLC"); 91 | if (EBLCTable != null) 92 | { 93 | string s = "Missing strike: "; 94 | bool bPass = true; 95 | 96 | for (uint i = 0; i < numSizes; i++) 97 | { 98 | bitmapScaleTable bitmapScale = GetBitmapScaleTable(i); 99 | 100 | if (bitmapScale != null) 101 | { 102 | bool bFound = false; 103 | 104 | for (uint n = 0; n < EBLCTable.numSizes; n++) 105 | { 106 | Table_EBLC.bitmapSizeTable bitmapSize = EBLCTable.GetBitmapSizeTable(n); 107 | if (bitmapSize != null) 108 | { 109 | if ( bitmapScale.substitutePpemX == bitmapSize.ppemX 110 | && bitmapScale.substitutePpemY == bitmapSize.ppemY) 111 | { 112 | bFound = true; 113 | break; 114 | } 115 | } 116 | 117 | } 118 | 119 | if (!bFound) 120 | { 121 | string size = "(PpemX:" + bitmapScale.substitutePpemX + ", PpemY:" + bitmapScale.substitutePpemY + ") "; 122 | s = s + size; 123 | bPass = false; 124 | } 125 | } 126 | } 127 | 128 | if (bPass) 129 | { 130 | v.Pass(T.EBSC_StrikeSizes, P.EBSC_P_StrikeSize, m_tag); 131 | } 132 | else 133 | { 134 | v.Error(T.EBSC_StrikeSizes, E.EBSC_E_StrikeSize, m_tag, s); 135 | } 136 | } 137 | else 138 | { 139 | v.Error(T.EBSC_StrikeSizes, E.EBSC_E_StrikeSizeNoEBLC, m_tag); 140 | } 141 | } 142 | 143 | 144 | return bRet; 145 | } 146 | 147 | 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /OTFontFileVal/val_VORG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_VORG. 9 | /// 10 | public class val_VORG : Table_VORG, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_VORG(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | /************************ 22 | * public methods 23 | */ 24 | 25 | 26 | public bool Validate(Validator v, OTFontVal fontOwner) 27 | { 28 | bool bRet = true; 29 | 30 | if (v.PerformTest(T.VORG_CFF_Font)) 31 | { 32 | if (fontOwner.ContainsPostScriptOutlines()) 33 | { 34 | v.Pass(T.VORG_CFF_Font, P.VORG_P_CFF_Font, m_tag); 35 | } 36 | else 37 | { 38 | v.Error(T.VORG_CFF_Font, E.VORG_E_CFF_Font, m_tag); 39 | bRet = false; 40 | } 41 | } 42 | 43 | if (v.PerformTest(T.VORG_Version)) 44 | { 45 | if (majorVersion == 1 && minorVersion == 0) 46 | { 47 | v.Pass(T.VORG_Version, P.VORG_P_Version, m_tag); 48 | } 49 | else 50 | { 51 | v.Error(T.VORG_Version, E.VORG_E_Version, m_tag); 52 | bRet = false; 53 | } 54 | } 55 | 56 | return bRet; 57 | } 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /OTFontFileVal/val__Unknown.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val__Unknown. 9 | /// 10 | public class val__Unknown : Table__Unknown, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val__Unknown(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public bool Validate(Validator v, OTFontVal fontOwner) 28 | { 29 | string sDetails = ""; 30 | 31 | string [] Apple_Tables = 32 | { 33 | "acnt", "avar", "bdat", "bhed", "bloc", "bsln", "cmap", "cvar", "cvt ", 34 | "EBSC", "fdsc", "feat", "fmtx", "fpgm", "gasp", "glyf", "gvar", "hdmx", 35 | "head", "hhea", "hmtx", "hsty", "just", "kern", "lcar", "loca", "maxp", 36 | "mort", "morx", "name", "opbd", "OS/2", "post", "prep", "prop", "trak", 37 | "vhea", "vmtx", "Zapf" 38 | }; 39 | 40 | string [] VOLT_only_Tables = 41 | { 42 | "TSIV" 43 | }; 44 | 45 | string [] VOLT_VTT_shared_Tables = 46 | { 47 | "TSIS", "TSIP", "TSID" 48 | }; 49 | 50 | string [] VTT_only_Tables = 51 | { 52 | "TSI0", "TSI1", "TSI2", "TSI3", "TSI4", "TSI5" ,"TSIJ", "TSIB" 53 | }; 54 | 55 | bool bIdentified = false; 56 | 57 | for (int i=0; i 8 | /// Summary description for val_cvt. 9 | /// 10 | public class val_cvt : Table_cvt, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_cvt(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | /************************ 22 | * public methods 23 | */ 24 | 25 | 26 | public bool Validate(Validator v, OTFontVal fontOwner) 27 | { 28 | bool bRet = true; 29 | 30 | if (v.PerformTest(T.cvt_length)) 31 | { 32 | if ((m_bufTable.GetLength() & 1) != 0) 33 | { 34 | v.Error(T.cvt_length, E.cvt_E_length_odd, m_tag); 35 | bRet = false; 36 | } 37 | else 38 | { 39 | v.Pass(T.cvt_length, P.cvt_P_length_even, m_tag); 40 | } 41 | } 42 | 43 | return bRet; 44 | } 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OTFontFileVal/val_fpgm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_fpgm. 9 | /// 10 | public class val_fpgm : Table_fpgm, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_fpgm(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public bool Validate(Validator v, OTFontVal fontOwner) 28 | { 29 | bool bRet = true; 30 | 31 | v.Info(I.fpgm_I_NotValidated, m_tag); 32 | 33 | return bRet; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /OTFontFileVal/val_gasp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_gasp. 9 | /// 10 | public class val_gasp : Table_gasp, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_gasp(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | 23 | /************************ 24 | * public methods 25 | */ 26 | 27 | 28 | public bool Validate(Validator v, OTFontVal fontOwner) 29 | { 30 | bool bRet = true; 31 | 32 | if (v.PerformTest(T.gasp_Version)) 33 | { 34 | if (version == 0 || version == 1) 35 | { 36 | v.Pass(T.gasp_Version, P.gasp_P_Version, m_tag, "version = " + version.ToString()); 37 | } 38 | else 39 | { 40 | v.Error(T.gasp_Version, E.gasp_E_Version, m_tag, "version = " + version.ToString() + ", unable to continue validation"); 41 | return false; 42 | } 43 | } 44 | 45 | if (v.PerformTest(T.gasp_rangeGaspBehavior)) 46 | { 47 | bool bFlagsOk = true; 48 | for (uint i=0; i 0x3) 54 | || (version == 1 && gr.rangeGaspBehavior > 0xf)) 55 | { 56 | bFlagsOk = false; 57 | break; 58 | } 59 | } 60 | } 61 | if (bFlagsOk) 62 | { 63 | v.Pass(T.gasp_rangeGaspBehavior, P.gasp_P_rangeGaspBehavior, m_tag); 64 | } 65 | else 66 | { 67 | v.Error(T.gasp_rangeGaspBehavior, E.gasp_E_rangeGaspBehavior, m_tag); 68 | bRet = false; 69 | } 70 | } 71 | 72 | if (v.PerformTest(T.gasp_SortOrder)) 73 | { 74 | bool bSortOk = true; 75 | if (numRanges > 1) 76 | { 77 | GaspRange grCurr = GetGaspRange(0); 78 | GaspRange grNext = null; 79 | for (uint i=1; i= grNext.rangeMaxPPEM) 83 | { 84 | bSortOk = false; 85 | break; 86 | } 87 | grCurr = grNext; 88 | } 89 | } 90 | if (bSortOk) 91 | { 92 | v.Pass(T.gasp_SortOrder, P.gasp_P_SortOrder, m_tag); 93 | } 94 | else 95 | { 96 | v.Error(T.gasp_SortOrder, E.gasp_E_SortOrder, m_tag); 97 | bRet = false; 98 | } 99 | } 100 | 101 | if (v.PerformTest(T.gasp_Sentinel)) 102 | { 103 | GaspRange gr = GetGaspRange((uint)numRanges-1); 104 | if (gr.rangeMaxPPEM == 0xFFFF) 105 | { 106 | v.Pass(T.gasp_Sentinel, P.gasp_P_Sentinel, m_tag); 107 | } 108 | else 109 | { 110 | v.Error(T.gasp_Sentinel, E.gasp_E_Sentinel, m_tag); 111 | bRet = false; 112 | } 113 | } 114 | 115 | if (v.PerformTest(T.gasp_AdjRangeIdenticalFlags)) 116 | { 117 | bool bNoAdjIdent = true; 118 | 119 | if (numRanges > 1) 120 | { 121 | for (uint i=0; i0) 93 | { 94 | bool isGErr=this.m_namesInfoCnt[iCnt].StartsWith("GERR_"); 95 | string nameFileErr=isGErr? GErrConsts.FILE_RES_GERR_STRINGS: GErrConsts.FILE_RES_OTFFERR_STRINGS; 96 | string nameAsmFileErr=isGErr? GErrConsts.ASM_RES_GERR_STRINGS: GErrConsts.ASM_RES_OTFFERR_STRINGS; 97 | string strDetails="Number of glyphs with the warning = "+this.m_cnts[iCnt]; 98 | if (validator.CancelFlag) 99 | strDetails+=" (Validation cancelled)"; 100 | ValInfoBasic info=new ValInfoBasic( 101 | ValInfoBasic.ValInfoType.Warning, 102 | this.m_namesInfoCnt[iCnt], 103 | strDetails, 104 | nameFileErr, 105 | nameAsmFileErr, 106 | "glyf", 107 | null); 108 | validator.DIA(info); 109 | } 110 | } 111 | 112 | this.m_cnts=null; 113 | return bRet; 114 | } 115 | 116 | 117 | 118 | /*=============================================================== 119 | * 120 | * I_IOGlyphsFont: IMPLEMENTATION & AUXILLIARY FUNCTIONS 121 | * 122 | *==============================================================*/ 123 | 124 | private DIAction m_diaValidate; 125 | private string[] m_namesInfoCnt= 126 | { 127 | "glyf_W_CompositeReservedBit", 128 | "GERR_CONT_DEGEN" 129 | }; 130 | private int[] m_cnts; 131 | 132 | private void DIAFunc_Filter(ValInfoBasic info) 133 | { 134 | if ((string)(info.TagPrincipal)=="loca") 135 | return; 136 | for (int iCnt=0; iCnt 9 | /// Summary description for val_hmtx. 10 | /// 11 | public class val_hmtx : Table_hmtx, ITableValidate 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public val_hmtx(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | 24 | /************************ 25 | * public methods 26 | */ 27 | 28 | 29 | public bool Validate(Validator v, OTFontVal fontOwner) 30 | { 31 | bool bRet = true; 32 | 33 | Table_hhea hheaTable = (Table_hhea)fontOwner.GetTable("hhea"); 34 | if (hheaTable == null) 35 | { 36 | v.Error(T.T_NULL, E._TEST_E_TableMissing, m_tag, "Unable to test this table, hhea table is invalid or missing"); 37 | return false; 38 | } 39 | 40 | Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp"); 41 | if (maxpTable == null) 42 | { 43 | v.Error(T.T_NULL, E._TEST_E_TableMissing, m_tag, "Unable to test this table, maxp table is invalid or missing"); 44 | return false; 45 | } 46 | 47 | if (v.PerformTest(T.hmtx_TableSize)) 48 | { 49 | uint nhm = GetNumberOfHMetrics(fontOwner); 50 | uint nlsb = GetNumLeftSideBearingEntries(fontOwner); 51 | uint CalcTableLength = nhm*4 + nlsb*2; 52 | 53 | if (CalcTableLength == GetLength()) 54 | { 55 | v.Pass(T.hmtx_TableSize, P.hmtx_P_TableSize, m_tag); 56 | } 57 | else 58 | { 59 | v.Error(T.hmtx_TableSize, E.hmtx_E_TableSize, m_tag); 60 | bRet = false; 61 | } 62 | } 63 | 64 | if (v.PerformTest(T.hmtx_CheckMetrics)) 65 | { 66 | bool bMetricsOk = true; 67 | 68 | for (uint iGlyph=0; iGlyph hm.advanceWidth) 75 | { 76 | v.Warning(T.hmtx_CheckMetrics, W.hmtx_W_CheckMetrics_lsb_gt_adv, m_tag, "glyph# " + iGlyph); 77 | bMetricsOk = false; 78 | } 79 | } 80 | else 81 | { 82 | // unable to fetch this horizontal metric 83 | // (probably bad hheaTable.numberOfHMetrics or bad table length) 84 | bMetricsOk = false; 85 | } 86 | } 87 | 88 | if (bMetricsOk) 89 | { 90 | v.Pass(T.hmtx_CheckMetrics, P.hmtx_P_CheckMetrics, m_tag); 91 | } 92 | } 93 | 94 | return bRet; 95 | } 96 | 97 | 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /OTFontFileVal/val_prep.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_prep. 9 | /// 10 | public class val_prep : Table_prep, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_prep(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public bool Validate(Validator v, OTFontVal fontOwner) 28 | { 29 | bool bRet = true; 30 | 31 | v.Info(I.prep_I_NotValidated, m_tag); 32 | 33 | return bRet; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /OTFontFileVal/val_vhea.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OTFontFile; 4 | 5 | namespace OTFontFileVal 6 | { 7 | /// 8 | /// Summary description for val_vhea. 9 | /// 10 | public class val_vhea : Table_vhea, ITableValidate 11 | { 12 | /************************ 13 | * constructors 14 | */ 15 | 16 | 17 | public val_vhea(OTTag tag, MBOBuffer buf) : base(tag, buf) 18 | { 19 | } 20 | 21 | 22 | /************************ 23 | * public methods 24 | */ 25 | 26 | 27 | public bool Validate(Validator v, OTFontVal fontOwner) 28 | { 29 | bool bRet = true; 30 | 31 | if (v.PerformTest(T.vhea_version)) 32 | { 33 | if (version.GetUint() == 0x00010000 || version.GetUint() == 0x00011000) 34 | { 35 | v.Pass(T.vhea_version, P.vhea_P_version, m_tag, "0x" + version.GetUint().ToString("x8")); 36 | } 37 | else 38 | { 39 | v.Error(T.vhea_version, E.vhea_E_version, m_tag, "0x" + version.GetUint().ToString("x8")); 40 | bRet = false; 41 | } 42 | } 43 | 44 | if (v.PerformTest(T.vhea_ReservedFields)) 45 | { 46 | if (reserved1 == 0 && reserved2 == 0 && reserved3 == 0 && reserved4 == 0) 47 | { 48 | v.Pass(T.vhea_ReservedFields, P.vhea_P_ReservedFields, m_tag); 49 | } 50 | else 51 | { 52 | v.Error(T.vhea_ReservedFields, E.vhea_E_ReservedFields, m_tag); 53 | bRet = false; 54 | } 55 | } 56 | 57 | if (v.PerformTest(T.vhea_metricDataFormat)) 58 | { 59 | if (metricDataFormat == 0) 60 | { 61 | v.Pass(T.vhea_metricDataFormat, P.vhea_P_metricDataFormat, m_tag); 62 | } 63 | else 64 | { 65 | v.Error(T.vhea_metricDataFormat, E.vhea_E_metricDataFormat, m_tag, metricDataFormat.ToString()); 66 | bRet = false; 67 | } 68 | } 69 | 70 | return bRet; 71 | } 72 | 73 | 74 | 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /OTFontFileVal/val_vmtx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | using OTFontFile; 5 | 6 | namespace OTFontFileVal 7 | { 8 | /// 9 | /// Summary description for val_vmtx. 10 | /// 11 | public class val_vmtx : Table_vmtx, ITableValidate 12 | { 13 | /************************ 14 | * constructors 15 | */ 16 | 17 | 18 | public val_vmtx(OTTag tag, MBOBuffer buf) : base(tag, buf) 19 | { 20 | } 21 | 22 | 23 | 24 | /************************ 25 | * public methods 26 | */ 27 | 28 | 29 | public bool Validate(Validator v, OTFontVal fontOwner) 30 | { 31 | bool bRet = true; 32 | 33 | Table_maxp maxpTable = (Table_maxp)fontOwner.GetTable("maxp"); 34 | if (maxpTable == null) 35 | { 36 | v.Error(T.T_NULL, E._TEST_E_TableMissing, m_tag, "Unable to test this table, maxp table is invalid or missing"); 37 | return false; 38 | } 39 | 40 | if (v.PerformTest(T.vmtx_TableLength)) 41 | { 42 | uint CalcTableLength = GetNumOfLongVerMetrics(fontOwner)*4 43 | + (fontOwner.GetMaxpNumGlyphs() - GetNumOfLongVerMetrics(fontOwner))*2; 44 | if (CalcTableLength == GetLength()) 45 | { 46 | v.Pass(T.vmtx_TableLength, P.vmtx_P_TableLength, m_tag); 47 | } 48 | else 49 | { 50 | v.Error(T.vmtx_TableLength, E.vmtx_E_TableLength, m_tag); 51 | bRet = false; 52 | } 53 | } 54 | 55 | return bRet; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /README-extra.txt: -------------------------------------------------------------------------------- 1 | Extended TODO's 2 | =============== 3 | 4 | (interesting/non-essential tasks, in no particular order) 5 | 6 | Fix the "MONO_WINFORMS_XIM_STYLE=disabled" bug. 7 | 8 | Fix the mono xsd bug (file it first!). 9 | 10 | Fix the monodevelop PostBuildEvent bug (file it first!). 11 | 12 | Find out why Wine-Mono complains about Illegal IL byte-codes, 13 | and why the XML viewer never worked in wine. 14 | 15 | IronPython scripted access to Font Validator's internals. 16 | 17 | Wrap the release binary's proprietary font scalar 18 | back into the current code, for compatibility testing 19 | on windows. (The code is about 6 years newer than the 20 | release binary). 21 | 22 | Spacing-layout issue in mono/X11's winform: the 23 | "Ctrl-O" ">" in the GUI's File->Open is squashed; 24 | the table test tab is without a scrollbar, but 25 | is invisible unless one resize slightly. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Font-Validator 2 | 3 | Font Validator is a tool for testing fonts prior to release. 4 | This testing ensures that fonts meet Microsoft's high quality standards and perform exceptionally well on Microsoft's platform. 5 | 6 | This project is not actively maintained. 7 | 8 | Hin-Tak Leung is actively maintaining and improving a forked version of Font Validator in [github.com/HinTak/Font-Validator](https://github.com/HinTak/Font-Validator/) 9 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Usage: 2 | ====== 3 | 4 | "FontVal.exe" is the GUI, and "FontValidator.exe" shows usage 5 | and example if run without arguments; both should be 6 | self-explanatory. (prepend with "mono" if runs on non-windows). 7 | 8 | The GUI's build-in help requires a CHM viewer, defaults to 9 | chmsee on Linux, or via env variable MONO_HELP_VIEWER. 10 | 11 | The GUI on X11/mono needs the env variable 12 | "MONO_WINFORMS_XIM_STYLE=disabled" set to work around a bug. 13 | (https://bugzilla.xamarin.com/show_bug.cgi?id=28047 14 | "Bug 28047 - Forms on separare threads -- Fatal errors/crashes"). 15 | 16 | Using "xsltproc" (commonly available on Linux and Mac OS X) 17 | one can generate an HTML report from the XML one, e.g. 18 | "xsltproc fval.xsl arial.ttf.report.xml > arial.ttf.report.htm" 19 | 20 | Build: 21 | ====== 22 | 23 | (adapted for building with mono instead of MS C#) 24 | 25 | Typing "make" should do. "make gendoc" and a few extra manual 26 | steps is only needed if one is making major changes of adding 27 | new tests or new error/warning codes. "make clean" deletes 28 | the newly generated binaries. 29 | 30 | Currently the CHM Help file requires MS Help Workshop to build, 31 | so is bundled in the bin/ directory; fval.xsl is also 32 | rarely changed, so duplicated there. The "bin" directory 33 | after "make" is the whole usable binary package. 34 | 35 | TODO (missing/broken): 36 | ====================== 37 | 38 | The 3 Rasterization Tests (BW, Grayscale, ClearType), 39 | 1 of the 4 LTSH tests (LTSH_yPels), 1 of the 4 VDMX tests 40 | (VDMX_CompareToCalcData) and 1 of the 8 VDMX tests (hdmx_Widths) 41 | requires the proprietary font scalar. 42 | 43 | 1 of 3 DSIG tests (DSIG_VerifySignature) requires 44 | Windows Trust API. 45 | 46 | 1 of 21 OS/2 tests (OS_2_CodePageRanges) requires Windows 47 | Code Page's. 48 | 49 | Viewing XML reports (and print, text search/select/copy therein) 50 | requires MSIE and Active X. 51 | 52 | summary: 194 table tests, 5 does not work. 53 | 54 | Annoyances: 55 | =========== 56 | 57 | Table order is case-insensitive sorted in GUI, but case-sensitive 58 | sorted in output. Would prefer all CAPs and sorted consistently. 59 | 60 | The command-line tool outputs one line per glyph per progress - 61 | over 100k lines for mingliu.ttc, which has 34k glyphs x 3 typefaces. 62 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /ValCommon/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | // 9 | [assembly: AssemblyTitle("")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("")] 14 | [assembly: AssemblyCopyright("")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Revision and Build Numbers 27 | // by using the '*' as shown below: 28 | 29 | [assembly: AssemblyVersion("1.0.*")] 30 | 31 | // 32 | // In order to sign your assembly you must specify a key to use. Refer to the 33 | // Microsoft .NET Framework documentation for more information on assembly signing. 34 | // 35 | // Use the attributes below to control which key is used for signing. 36 | // 37 | // Notes: 38 | // (*) If no key is specified, the assembly is not signed. 39 | // (*) KeyName refers to a key that has been installed in the Crypto Service 40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains 41 | // a key. 42 | // (*) If the KeyFile and the KeyName values are both specified, the 43 | // following processing occurs: 44 | // (1) If the KeyName can be found in the CSP, that key is used. 45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key 46 | // in the KeyFile is installed into the CSP and used. 47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. 48 | // When specifying the KeyFile, the location of the KeyFile should be 49 | // relative to the project output directory which is 50 | // %Project Directory%\obj\. For example, if your KeyFile is 51 | // located in the project directory, you would specify the AssemblyKeyFile 52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] 53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework 54 | // documentation for more information on this. 55 | // 56 | [assembly: AssemblyDelaySign(false)] 57 | [assembly: AssemblyKeyFile("")] 58 | [assembly: AssemblyKeyName("")] 59 | -------------------------------------------------------------------------------- /ValCommon/DIAction.cs: -------------------------------------------------------------------------------- 1 | namespace NS_ValCommon 2 | { 3 | public delegate void DIAction(ValInfoBasic info); 4 | /* 5 | public interface I_DIAProvider 6 | { 7 | DelegInfoAction DelegIA(); 8 | } 9 | */ 10 | } 11 | 12 | -------------------------------------------------------------------------------- /ValCommon/DIActionBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NS_ValCommon 4 | { 5 | public class DIActionBuilder 6 | { 7 | static public DIAction DIA(object obj, string nameDIA) 8 | { 9 | if ((obj==null) || (nameDIA==null)) 10 | return null; 11 | return ((Delegate.CreateDelegate(typeof(DIAction),obj,nameDIA)) as DIAction); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /ValCommon/DIActionContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Collections; 4 | 5 | namespace NS_ValCommon 6 | { 7 | public class DIActionContainer 8 | { 9 | /* 10 | * MEMBERS 11 | */ 12 | protected DIAction dia; 13 | 14 | /* 15 | * PROPERTIES 16 | */ 17 | public DIAction DIA 18 | { 19 | get {return this.dia;} 20 | set {this.dia=value;} 21 | } 22 | 23 | /* 24 | * CONVERSIONS 25 | */ 26 | public static implicit operator DIAction(DIActionContainer diac) 27 | { 28 | return diac.DIA; 29 | } 30 | 31 | /* 32 | * CONSTRUCTORS 33 | */ 34 | public DIActionContainer(params DIAction[] dias) 35 | { 36 | if (dias!=null) 37 | { 38 | foreach (DIAction dia in dias) 39 | { 40 | if (dia!=null) 41 | { 42 | if (this.dia==null) 43 | { 44 | this.dia=dia; 45 | } 46 | else 47 | { 48 | this.dia=System.Delegate.Combine(this.dia,dia) as DIAction; 49 | } 50 | } 51 | } 52 | } 53 | } 54 | 55 | /* 56 | * METHODS 57 | */ 58 | public bool AddDeleg(DIAction diaToAdd) 59 | { 60 | if (diaToAdd==null) 61 | return true; 62 | if (this.dia==null) 63 | { 64 | this.dia=diaToAdd; 65 | } 66 | else 67 | { 68 | this.dia=(MulticastDelegate.Combine(this.dia,diaToAdd)) as DIAction; 69 | } 70 | return true; 71 | } 72 | 73 | public bool AddDeleg(object obj, string nameDIA) 74 | { 75 | DIAction dia=DIActionBuilder.DIA(obj,nameDIA); 76 | return (this.AddDeleg(dia)); 77 | } 78 | 79 | public bool RemoveDeleg(object objToRemove) 80 | { 81 | if ((objToRemove==null)||(this.dia==null)) 82 | return false; 83 | ArrayList diasToRemove=null; 84 | Delegate[] delegs=this.dia.GetInvocationList(); 85 | foreach (Delegate deleg in delegs) 86 | { 87 | object obj=deleg.Target; 88 | if (Object.ReferenceEquals(obj,objToRemove)) 89 | { 90 | if (diasToRemove==null) 91 | { 92 | diasToRemove=new ArrayList(); 93 | } 94 | diasToRemove.Add(deleg); 95 | } 96 | } 97 | if (diasToRemove==null) 98 | return false; 99 | bool res=true; 100 | foreach (Delegate diaToRemove in diasToRemove) 101 | { 102 | res=res && this.RemoveDeleg(diaToRemove); 103 | } 104 | return res; 105 | } 106 | 107 | public bool RemoveDeleg(DIAction diaToRemove) 108 | { 109 | if (diaToRemove==null) 110 | return false; 111 | if (this.dia==null) 112 | return false; 113 | this.dia=(MulticastDelegate.Remove(this.dia,diaToRemove)) as DIAction; 114 | return true; 115 | } 116 | 117 | // wrapper - reports errors 118 | public void SendInfo(ValInfoBasic info) 119 | { 120 | if (this.dia!=null) 121 | { 122 | dia(info); 123 | } 124 | } 125 | 126 | public void SendInfoOneByOne(ValInfoBasic info, out string strErrMessage) 127 | { 128 | strErrMessage=null; 129 | StringBuilder sb=null; 130 | if (this.dia==null) 131 | return; 132 | Delegate[] delegs=this.dia.GetInvocationList(); 133 | foreach (Delegate deleg in delegs) 134 | { 135 | try 136 | { 137 | DIAction dia=(DIAction)deleg; 138 | dia(info); 139 | } 140 | catch 141 | { 142 | if (sb==null) 143 | { 144 | sb=new StringBuilder(); 145 | } 146 | sb.Append(deleg.Target.GetType()); 147 | sb.Append("\r\n"); 148 | } 149 | } 150 | strErrMessage=sb.ToString(); 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /ValCommon/DIActionOnCondBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NS_ValCommon 4 | { 5 | public class DIActionOnCondBuilder 6 | { 7 | private DICond dic; 8 | private DIAction dia; 9 | 10 | 11 | public DIActionOnCondBuilder(DICond dic, DIAction dia) 12 | { 13 | this.dic=dic; 14 | this.dia=dia; 15 | } 16 | public void DIAFunc(ValInfoBasic info) 17 | { 18 | if (this.dic(info)) 19 | { 20 | this.dia(info); 21 | } 22 | } 23 | public DIAction DIA 24 | { 25 | get 26 | { 27 | if ((this.dic==null)||(this.dia==null)) 28 | return null; 29 | return DIActionBuilder.DIA(this,"DIAFunc"); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ValCommon/DICond.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace NS_ValCommon 5 | { 6 | public delegate bool DICond(ValInfoBasic info); 7 | } -------------------------------------------------------------------------------- /ValCommon/DICondBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Diagnostics; 4 | 5 | namespace NS_ValCommon 6 | { 7 | public class DICondBuilder 8 | { 9 | object obj; 10 | Type typeObj; 11 | private object[] pars; 12 | MethodInfo infoMethod; 13 | 14 | private DICondBuilder() 15 | { 16 | this.obj=null; 17 | this.infoMethod=null; 18 | this.typeObj=null; 19 | this.infoMethod=null; 20 | } 21 | 22 | public DICondBuilder(Type typeObj, string nameMethod, params object[] pars) 23 | : this() 24 | 25 | { 26 | // for static methods 27 | this.typeObj=typeObj; 28 | this.pars=new object[pars.Length+1]; 29 | 30 | Type[] types=new Type[pars.Length+1]; 31 | types[0]=typeof(ValInfoBasic); 32 | for (int iPar=0; iPar 4 | 5 | //Returns 0 if and only if the font passes all the tests of the validator (it may have warnings, but no errors) 6 | extern "C" _declspec(dllexport) int ValidateFont(HANDLE,int,char**,int); 7 | -------------------------------------------------------------------------------- /bin/FontValidatorHelp.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/Font-Validator/03011e3ceec2c68462fe1b528064f64424cfdc44/bin/FontValidatorHelp.chm --------------------------------------------------------------------------------