{ "name": "Adobe Font Metrics", "scopeName": "source.afm", "patterns": [ { "include": "#resources" }, { "include": "#main" } ], "repository": { "amfmSpecific": { "name": "meta.${2:/downcase}.afm", "begin": "^(Start(Descendent|Direction|Axis|Master))(?:\\s+(\\S.*))?", "end": "^End\\2\\s*$", "patterns": [ { "include": "#main" } ], "beginCaptures": { "1": { "name": "keyword.control.start.${2:/downcase}.afm" }, "3": { "patterns": [ { "include": "#hex" }, { "include": "#integer" } ] } }, "endCaptures": { "0": { "name": "keyword.control.end.${2:/downcase}.afm" } } }, "array": { "begin": "\\[", "end": "\\]|(?=$)", "patterns": [ { "include": "#array" }, { "include": "#numbers" }, { "include": "#psLiteral" } ], "beginCaptures": { "0": { "name": "punctuation.definition.list.bracket.square.begin.afm" } }, "endCaptures": { "0": { "name": "punctuation.definition.list.bracket.square.end.afm" } } }, "bestGuessHighlights": { "patterns": [ { "match": "\\G\\s*(true|false)(?=\\s|$)", "captures": { "1": { "patterns": [ { "include": "#boolean" } ] } } }, { "match": "^(?:\\s+[-+]?[.\\d]+)+\\s*$", "captures": { "0": { "patterns": [ { "include": "#numbers" } ] } } }, { "match": "^\\s*(\\[.*\\])\\s*$", "captures": { "0": { "patterns": [ { "include": "#array" }, { "include": "#main" } ] } } }, { "match": "^\\s*\u003c[A-Fa-f0-9]+\u003e\\s*$", "captures": { "0": { "patterns": [ { "include": "#hex" } ] } } }, { "match": "(?:(?:^|\\s+)/[^\\s\\[\\];]+)+\\s*$", "captures": { "0": { "patterns": [ { "include": "#psLiteral" } ] } } }, { "name": "variable.assignment.afm", "match": "^.+$", "captures": { "0": { "name": "string.unquoted.afm" } } } ] }, "boolean": { "name": "constant.language.boolean.$1.afm", "match": "(?\u003c!\\w)(true|false)(?!\\w)" }, "bracketedString": { "name": "string.quoted.double.bracketed.afm", "begin": "\\(", "end": "\\)|(?=$)", "patterns": [ { "include": "#bracketedString" } ], "beginCaptures": { "0": { "name": "punctuation.definition.bracket.round.begin.afm" } }, "endCaptures": { "0": { "name": "punctuation.definition.bracket.round.end.afm" } } }, "charMetricInnards": { "patterns": [ { "include": "#delimiter" }, { "name": "meta.character.code.hexadecimal.afm", "match": "\\G(CH)\\s+(\u003c[^\u003e\\s]++\u003e)\\s*(?=;|$)", "captures": { "1": { "name": "variable.assignment.codepoint.afm" }, "2": { "patterns": [ { "include": "#hex" } ] } } }, { "name": "meta.character.code.decimal.afm", "match": "\\G(C)\\s+([-+]?\\d+)\\s*(?=;|$)", "captures": { "1": { "name": "variable.assignment.codepoint.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } } }, { "name": "meta.metric.character.width.afm", "begin": "(?\u003c=\\s|^|;)(W[01]?|VV)(?=\\s|;|$)", "end": "(?=;|$)", "patterns": [ { "include": "#numbers" } ], "beginCaptures": { "1": { "name": "variable.assignment.character-width.afm" } } }, { "name": "meta.metric.character.width.afm", "match": "(?\u003c=\\s|^|;)(W[01]?(X|Y))(?:\\s+([-+]?[\\d.]+)\\s*)(?=\\s|$|;)", "captures": { "1": { "name": "variable.assignment.${2:/downcase}-width.afm" }, "3": { "patterns": [ { "include": "#integer" } ] } } }, { "name": "meta.metric.character.name.afm", "match": "(?\u003c=\\s|^|;)(N)(?:\\s+([^;\\s]+))?\\s*(?=\\s|$|;)", "captures": { "1": { "name": "variable.assignment.character.name.afm" }, "2": { "name": "string.unquoted.parameter.identifier.afm" } } }, { "name": "meta.metric.bounding-box.afm", "begin": "(?\u003c=\\s|^|;)(B)(?=\\s|$|;)", "end": "(?=$|;)", "patterns": [ { "include": "#numbers" } ], "beginCaptures": { "1": { "name": "variable.assignment.metric.afm" } } }, { "name": "meta.metric.next-ligature.afm", "begin": "(?\u003c=\\s|^|;)(L)(?=\\s|$|;)", "end": "(?=$|;)", "patterns": [ { "include": "#name" } ], "beginCaptures": { "1": { "name": "variable.assignment.metric.afm" } } } ] }, "charMetrics": { "name": "meta.metrics-list.afm", "begin": "^(StartCharMetrics)(?:\\s+(\\d+))?\\s*$", "end": "^EndCharMetrics\\s*$", "patterns": [ { "include": "#comment" }, { "name": "meta.unencoded.character.metrics.afm", "begin": "^\\s*(?=C\\s+-\\d)", "end": "$", "patterns": [ { "include": "#charMetricInnards" } ] }, { "name": "meta.character.metrics.afm", "begin": "^\\s*", "end": "$", "patterns": [ { "include": "#charMetricInnards" } ] } ], "beginCaptures": { "1": { "name": "keyword.control.start.metrics.afm" }, "2": { "name": "constant.numeric.decimal.integer.afm" } }, "endCaptures": { "0": { "name": "keyword.control.end.metrics.afm" } } }, "comment": { "contentName": "comment.line.afm", "begin": "^Comment(?=\\s|$)", "end": "$", "beginCaptures": { "0": { "name": "keyword.operator.start-comment.afm" } } }, "compositesData": { "name": "meta.composites.afm", "begin": "^(StartComposites)(?:\\s+([-+]?\\d+))?\\s*$", "end": "^EndComposites", "patterns": [ { "include": "#comment" }, { "name": "meta.composition.afm", "begin": "^CC(?=\\s|$|;)", "end": "$", "patterns": [ { "include": "#delimiter" }, { "match": "\\G\\s+([^;\\s]+)(?:\\s+([-+]?\\d+))?", "captures": { "1": { "name": "string.unquoted.parameter.identifier.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } } }, { "match": "(?\u003c=;|\\s)(PCC)\\s+([^;\\s]+)", "captures": { "1": { "name": "keyword.operator.char-comp.afm" }, "2": { "name": "string.unquoted.parameter.identifier.afm" } } }, { "include": "#numbers" } ], "beginCaptures": { "0": { "name": "keyword.operator.char-comp.afm" } } } ], "beginCaptures": { "1": { "name": "keyword.control.start.metrics.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } }, "endCaptures": { "0": { "name": "keyword.control.end.metrics.afm" } } }, "delimiter": { "name": "punctuation.delimiter.metrics.semicolon.afm", "match": ";" }, "globalInfo": { "patterns": [ { "name": "meta.${1:/downcase}-name.afm", "begin": "^(Font|Full|Family)Name(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramName" } ], "beginCaptures": { "0": { "name": "keyword.operator.${1:/downcase}-name.afm" } } }, { "name": "meta.writing-directions.afm", "begin": "^MetricsSets(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramInteger" } ], "beginCaptures": { "0": { "name": "keyword.operator.metrics-sets.afm" } } }, { "name": "meta.is-monospaced-font.afm", "begin": "^IsFixedPitch(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramBoolean" } ], "beginCaptures": { "0": { "name": "keyword.operator.is-fixed-pitch.afm" } } }, { "name": "meta.notice.afm", "begin": "^Notice(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramString" } ], "beginCaptures": { "0": { "name": "keyword.operator.notice.afm" } } }, { "name": "meta.revision.afm", "begin": "^Version(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramString" } ], "beginCaptures": { "0": { "name": "keyword.operator.version.afm" } } }, { "name": "meta.weight.afm", "begin": "^Weight(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramString" } ], "beginCaptures": { "0": { "name": "keyword.operator.weight.afm" } } }, { "name": "meta.italic-angle.afm", "begin": "^ItalicAngle(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumber" } ], "beginCaptures": { "0": { "name": "keyword.operator.italic-angle.afm" } } }, { "name": "meta.bounding-box.afm", "begin": "^FontBBox(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumbers" } ], "beginCaptures": { "0": { "name": "keyword.operator.font-bbox.afm" } } }, { "name": "meta.encoding-scheme.afm", "begin": "^EncodingScheme(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramString" } ], "beginCaptures": { "0": { "name": "keyword.operator.encoding-scheme.afm" } } }, { "name": "meta.underline-property.${1:/downcase}.afm", "begin": "^Underline(Position|Thickness)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumber" } ], "beginCaptures": { "0": { "name": "keyword.operator.underline-${1:/downcase}.afm" } } }, { "name": "meta.metric.${1:/downcase}-height.afm", "begin": "^(Cap|X)Height(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumber" } ], "beginCaptures": { "0": { "name": "keyword.operator.${1:/downcase}-height.afm" } } }, { "name": "meta.metric.${1:/downcase}.afm", "begin": "^(Descender|Ascender)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumber" } ], "beginCaptures": { "0": { "name": "keyword.operator.${1:/downcase}.afm" } } }, { "name": "meta.metric.${1:/downcase}.afm", "begin": "^(CharacterSet|AxisType|AxisLabel)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramString" } ], "beginCaptures": { "0": { "name": "keyword.operator.metadata.afm" } } }, { "name": "meta.metadata.${1:/downcase}.afm", "begin": "^(Characters|EscChar|MappingScheme)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumber" } ], "beginCaptures": { "1": { "name": "keyword.operator.metadata.afm" } } }, { "name": "meta.metadata.${1:/downcase}.afm", "begin": "^(IsBaseFont|IsFixedV|IsCIDFont)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramBoolean" } ], "beginCaptures": { "1": { "name": "keyword.operator.metadata.afm" } } }, { "name": "meta.metadata.${1:/downcase}.afm", "begin": "^(CharWidth|VVector|Masters|Axes|Std[HV]W)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#paramNumbers" } ], "beginCaptures": { "1": { "name": "keyword.operator.metadata.afm" } } }, { "name": "meta.metadata.${1:/downcase}.afm", "begin": "^(WeightVector|BlendDesign(Positions|Map)|BlendAxisTypes)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#array" }, { "include": "#numbers" }, { "include": "#psLiteral" } ], "beginCaptures": { "1": { "name": "keyword.operator.metadata.afm" } } } ] }, "hex": { "name": "constant.numeric.integer.hexadecimal.afm", "match": "(\u003c)(?:[A-Fa-f0-9]+|([^\u003e\\s]+))(\u003e)", "captures": { "1": { "name": "punctuation.definition.hex.bracket.angle.begin.afm" }, "2": { "name": "invalid.illegal.syntax.bad-characters.afm" }, "3": { "name": "punctuation.definition.hex.bracket.angle.end.afm" } } }, "integer": { "patterns": [ { "name": "constant.numeric.integer.octal.afm", "match": "(?\u003c!\\w)[-+]?(?=0)\\d+" }, { "name": "constant.numeric.integer.decimal.afm", "match": "(?\u003c!\\w)[-+]?\\d+" } ] }, "kerningData": { "name": "meta.kerning-data.afm", "begin": "^(StartKernData)\\s*$", "end": "^EndKernData\\s*$", "patterns": [ { "begin": "^(StartTrackKern)(?:\\s+([-+]?\\d+))?\\s*$", "end": "^EndTrackKern\\s*$", "patterns": [ { "include": "#comment" }, { "include": "#kerningTrack" } ], "beginCaptures": { "1": { "name": "keyword.control.start.metrics.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } }, "endCaptures": { "0": { "name": "keyword.control.end.metrics.afm" } } }, { "begin": "^(StartKernPairs[0-1]?)(?:\\s+([-+]?\\d+))?\\s*$", "end": "^EndKernPairs\\s*$", "patterns": [ { "include": "#comment" }, { "include": "#kerningPairs" } ], "beginCaptures": { "1": { "name": "keyword.control.start.metrics.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } }, "endCaptures": { "0": { "name": "keyword.control.end.metrics.afm" } } } ], "beginCaptures": { "1": { "name": "keyword.control.start.metrics.afm" } }, "endCaptures": { "0": { "name": "keyword.control.end.metrics.afm" } } }, "kerningPairs": { "patterns": [ { "name": "meta.kerning-pair.by-codepoint.afm", "begin": "^KPH(?=\\s|$)", "end": "^|$", "patterns": [ { "match": "\\G((?:\\s+\u003c[^\u003e\\s]*\u003e)+)\\s+", "captures": { "1": { "patterns": [ { "include": "#hex" } ] } } }, { "include": "#numbers" } ], "beginCaptures": { "0": { "name": "keyword.operator.kern-pair.afm" } } }, { "name": "meta.kerning-pair.by-name.afm", "begin": "^KP[XY]?(?=\\s|$)", "end": "^|$", "patterns": [ { "match": "\\G((?:\\s+\\S+){1,2})", "captures": { "1": { "patterns": [ { "include": "#name" } ] } } }, { "include": "#numbers" } ], "beginCaptures": { "0": { "name": "keyword.operator.kern-pair.afm" } } } ] }, "kerningTrack": { "begin": "^(TrackKern)(?=\\s|$)", "end": "^|$", "patterns": [ { "include": "#numbers" } ], "beginCaptures": { "1": { "name": "keyword.operator.track-kern.afm" } } }, "main": { "patterns": [ { "include": "#comment" }, { "include": "#real" }, { "include": "#integer" }, { "include": "#array" }, { "include": "#globalInfo" }, { "include": "#kerningData" }, { "include": "#charMetrics" }, { "include": "#compositesData" }, { "include": "#amfmSpecific" }, { "include": "#direction" }, { "include": "#primaryFonts" }, { "include": "#reserved" }, { "include": "#userDefined" } ] }, "name": { "name": "string.unquoted.parameter.identifier.afm", "match": "[^;\\s]+" }, "numbers": { "patterns": [ { "include": "#real" }, { "include": "#integer" } ] }, "paramBoolean": { "patterns": [ { "match": "\\G\\s+(true|false)\\s*$", "captures": { "1": { "patterns": [ { "include": "#boolean" } ] } } }, { "include": "#paramInvalid" } ] }, "paramInteger": { "patterns": [ { "match": "\\G\\s+([-+]?[0-9]+)\\s*$", "captures": { "1": { "patterns": [ { "include": "#integer" } ] } } }, { "include": "#paramInvalid" } ] }, "paramInvalid": { "match": "\\G\\s+(\\S+.+)\\s*$", "captures": { "1": { "name": "invalid.illegal.syntax.type.afm" } } }, "paramName": { "match": "\\G\\s+(\\S+.*)\\s*$", "captures": { "1": { "name": "entity.name.identifier.afm" } } }, "paramNumber": { "patterns": [ { "match": "\\G\\s+([-+]?(?:\\d*\\.\\d+|\\d+))\\s*$", "captures": { "1": { "patterns": [ { "include": "#real" }, { "include": "#integer" } ] } } }, { "include": "#paramInvalid" } ] }, "paramNumbers": { "patterns": [ { "include": "#real" }, { "include": "#integer" }, { "name": "invalid.illegal.syntax.type.afm", "match": "(?![-+0-9.])\\S+" } ] }, "paramString": { "name": "variable.assignment.afm", "match": "\\G\\s+(\\S.*)\\s*$", "captures": { "1": { "name": "string.unquoted.afm" } } }, "paramVar": { "match": "\\G\\s+(\\S.*)\\s*$", "captures": { "1": { "name": "variable.assignment.afm" } } }, "primaryFontLine": { "patterns": [ { "name": "invalid.illegal.syntax.empty-field.afm", "match": "(?\u003c=^|\\s|;)(?:PC|PL|PN)(?=\\s*;)" }, { "name": "meta.primary-coordinates.afm", "begin": "(?\u003c=^|\\s|;)PC(?=\\s|$)", "end": "(?=;|$|[A-Z])", "patterns": [ { "include": "#real" }, { "include": "#integer" } ], "beginCaptures": { "0": { "name": "variable.assignment.metadata.afm" } } }, { "begin": "(?\u003c=\\s|;)(P[LN])\\s+", "end": "(?=;|$)", "patterns": [ { "include": "#bracketedString" }, { "include": "#delimiter" } ], "beginCaptures": { "1": { "name": "variable.assignment.metadata.afm" } } }, { "include": "#delimiter" } ] }, "primaryFonts": { "name": "meta.primary-fonts.afm", "begin": "^(StartPrimaryFonts)(?:\\s+([-+]?\\d+))?\\s*$", "end": "\\bEndPrimaryFonts(?=\\s|$)|(?!P)(?=\\w)", "patterns": [ { "include": "#comment" }, { "include": "#delimiter" }, { "include": "#primaryFontLine" } ], "beginCaptures": { "1": { "name": "keyword.control.start.font-list.afm" }, "2": { "patterns": [ { "include": "#integer" } ] } }, "endCaptures": { "0": { "name": "keyword.control.end.font-list.afm" } } }, "psLiteral": { "name": "support.language.constant.literal.afm", "match": "(/)[^\\s\\[\\];]+", "captures": { "1": { "name": "punctuation.definition.literal.slash.afm" } } }, "real": { "name": "constant.numeric.float.afm", "match": "(?\u003c!\\w)[-+]?\\d*\\.\\d+" }, "reserved": { "match": "^([A-Z][A-Za-z0-9]+)(?=\\s)(.*)$", "captures": { "1": { "name": "variable.other.reserved.afm" }, "2": { "patterns": [ { "include": "#bestGuessHighlights" } ] } } }, "resources": { "patterns": [ { "name": "meta.metrics.file-resource.afm", "begin": "^(StartFontMetrics)\\s+(\\d+(?:\\.\\d+)?)?\\s*$", "end": "^(EndFontMetrics)\\s*$", "patterns": [ { "include": "#main" } ], "beginCaptures": { "1": { "name": "keyword.control.start.file.afm" }, "2": { "name": "constant.numeric.float.decimal.version-number.afm" } }, "endCaptures": { "1": { "name": "keyword.control.end.file.afm" } } }, { "name": "meta.composite.metrics.file-resource.afm", "begin": "^(StartCompFontMetrics)\\s+(\\d+(?:\\.\\d+)?)?\\s*$", "end": "^(EndCompFontMetrics)\\s*$", "patterns": [ { "include": "#main" } ], "beginCaptures": { "1": { "name": "keyword.control.start.file.afm" }, "2": { "name": "constant.numeric.float.decimal.version-number.afm" } }, "endCaptures": { "1": { "name": "keyword.control.end.file.afm" } } }, { "name": "meta.master.metrics.file-resource.afm", "begin": "^(StartMasterFontMetrics)\\s+(\\d+(?:\\.\\d+)?)?\\s*$", "end": "^(EndMasterFontMetrics)\\s*$", "patterns": [ { "include": "#main" } ], "beginCaptures": { "1": { "name": "keyword.control.start.file.afm" }, "2": { "name": "constant.numeric.float.decimal.version-number.afm" } }, "endCaptures": { "1": { "name": "keyword.control.end.file.afm" } } } ] }, "userDefined": { "match": "^([a-z][A-Za-z0-9]+)(?=\\s)(.*)$", "captures": { "1": { "name": "variable.other.custom.afm" }, "2": { "patterns": [ { "include": "#bestGuessHighlights" } ] } } } } }