/// <summary> /// Compiles state machine for positioning feature and saves state machine to <paramref name="positioning"/> appendix. /// </summary> /// <param name="typeface">Glyph typeface in which look for feature.</param> /// <param name="scriptId">ID of script in which look for feature.</param> /// <param name="languageId">ID of language in which look for feature.</param> /// <param name="featureId">ID of feature to look up.</param> /// <param name="positioning">Positioning appendix in which will be compiled state machine stored.</param> /// <param name="glyphClasses">Glyph classes appendix for use by positioning appendix.</param> /// <param name="availableGlyphs">Which glyphs should be restricted in state machine.</param> /// <param name="emSize">Requested em size.</param> /// <returns>All used glyphs during compilation. Can add additional glyphs to availableGlyphs.</returns> public virtual IEnumerable <ushort> CompileFeature(GlyphTypeface typeface, uint scriptId, uint languageId, uint featureId, PositioningAppendix positioning, GlyphClassesAppendix glyphClasses, IEnumerable <ushort> availableGlyphs, double emSize) { StateMachine machine = GetOrCompile(_gposParser, new PositioningCompiler(), typeface, scriptId, languageId, featureId); machine = new StateMachineOptimizer().Optimize(machine); machine = new StateMachineNormalizer().Normalize(machine, availableGlyphs); this.CompilePositioningAppendixFromMachine(typeface, featureId, positioning, glyphClasses, emSize, machine); return(machine.GetGeneratedGlyphIds()); }
/// <summary> /// Compiles state machine for substitution feature and saves state machine to <paramref name="substitution"/> appendix. /// </summary> /// <param name="typeface">Glyph typeface in which look for feature.</param> /// <param name="scriptId">ID of script in which look for feature.</param> /// <param name="languageId">ID of language in which look for feature.</param> /// <param name="featureId">ID of feature to look up.</param> /// <param name="substitution">Substitution appendix in which will be compiled state machine stored.</param> /// <param name="glyphClasses">Glyph classes appendix for use by substitution appendix.</param> /// <param name="availableGlyphs">Which glyphs should be restricted in state machine.</param> /// <returns>All used glyphs during compilation. Can add additional glyphs to availableGlyphs.</returns> public virtual IEnumerable <ushort> CompileFeature(GlyphTypeface typeface, uint scriptId, uint languageId, uint featureId, SubstitutionAppendix substitution, GlyphClassesAppendix glyphClasses, IEnumerable <ushort> availableGlyphs) { StateMachine machine = GetOrCompile(_gsubParser, new SubstitutionCompiler(), typeface, scriptId, languageId, featureId); machine = new StateMachineOptimizer().Optimize(machine); machine = new StateMachineNormalizer().Normalize(machine, availableGlyphs); this.CompileSubstitutionAppendingFromMachine(featureId, substitution, glyphClasses, machine); return(machine.GetGeneratedGlyphIds()); }