/// <summary> /// Gets a collection of all language systems supported by a single script the typeface. List of all known lang sys tags can be found here: http://www.microsoft.com/typography/developers/opentype/languagetags.aspx . /// </summary> /// <param name="typeface">The typeface.</param> /// <param name="script">The script tag.</param> /// <returns> /// Collection of tags. /// </returns> public IEnumerable <Tag> GetLangSysTags(GlyphTypeface typeface, Tag script) { dynamic fontTableHeader = this.GetFontTableHeader(); dynamic fontTable = this.GetFontTable(typeface); if (!fontTable.IsPresent) { yield break; } dynamic scriptList = new AccessPrivateWrapper(fontTableHeader.GetScriptList(fontTable.Wrapped)); dynamic scriptTable = new AccessPrivateWrapper(scriptList.FindScript(fontTable.Wrapped, TagConverter.UintFromTag(script))); if (scriptTable.IsNull) { throw new ArgumentOutOfRangeException("script"); } if (scriptTable.IsDefaultLangSysExists(fontTable.Wrapped)) { yield return(new Tag("dflt")); } var uintTags = this.GetEnumerableFromInternalList( () => scriptTable.GetLangSysCount(fontTable.Wrapped), p => (uint)scriptTable.GetLangSysTag(fontTable.Wrapped, p)); foreach (var uintTag in uintTags) { yield return(TagConverter.TagFromUint(uintTag)); } }
/// <summary> /// Gets the language system table. /// </summary> /// <param name="script">The script tag.</param> /// <param name="langSys">The language system tag.</param> /// <param name="fontTable">The font table.</param> /// <returns>Language system table</returns> private dynamic GetLangSysTable(Tag script, Tag langSys, dynamic fontTable) { dynamic fontTableHeader = this.GetFontTableHeader(); dynamic scriptList = new AccessPrivateWrapper(fontTableHeader.GetScriptList(fontTable.Wrapped)); dynamic scriptTable = new AccessPrivateWrapper(scriptList.FindScript(fontTable.Wrapped, TagConverter.UintFromTag(script))); if (scriptTable.IsNull) { throw new ArgumentOutOfRangeException("script"); } dynamic langSysTable = langSys == null ? new AccessPrivateWrapper(scriptTable.GetDefaultLangSysTable(fontTable.Wrapped)) : new AccessPrivateWrapper(scriptTable.FindLangSys(fontTable.Wrapped, TagConverter.UintFromTag(langSys))); if (langSysTable.IsNull) { throw new ArgumentOutOfRangeException("langSys"); } return(langSysTable); }