Notepad++: Syntax highlighting for FontForge Script

FontForge comes with two scripting systems - largely-regular Python and an unnamed scripting language that uses the extension .PE.

While the documentation advices to prefer Python scripting where possible, it is still nice to be able to read the existing PE scripts easier.

This User Defined Language for Notepad++ aids with that, adding folding and syntax highlighting for built-in functions and variables of the scripting language.

Originally I made this UDL sometime around 2015 when I started working on pixel art fonts and found that my "pipeline" (pixel art editor -> custom tool -> BitFontMaker2 -> TTF file) commonly required series of post-fixes to accomplish correct line height / spacing / rendering.

Fast-forward to 2019, I'm moving files to the new computer and realize that I never published this UDL. So, here you go:

Download UDL

Alternatively, here's the entirety of that:

<NotepadPlus>
    <UserLang name="FF Script" ext="pe" udlVersion="2.1">
        <Settings>
            <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
            <Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Comments">00# 00// 01 02 03/* 04*/</Keywords>
            <Keywords name="Numbers, prefix1"></Keywords>
            <Keywords name="Numbers, prefix2">0x 0u 0U</Keywords>
            <Keywords name="Numbers, extras1">a b c d e f A B C D E F</Keywords>
            <Keywords name="Numbers, extras2"></Keywords>
            <Keywords name="Numbers, suffix1"></Keywords>
            <Keywords name="Numbers, suffix2"></Keywords>
            <Keywords name="Numbers, range"></Keywords>
            <Keywords name="Operators1">+ - ! ~ ++ -- ( ) [ ] :h :t :r :e * / % == != &gt; &lt; &gt;= &lt;= &amp;&amp; &amp; || | ^ = += -= *= /= %= , ;</Keywords>
            <Keywords name="Operators2"></Keywords>
            <Keywords name="Folders in code1, open"></Keywords>
            <Keywords name="Folders in code1, middle"></Keywords>
            <Keywords name="Folders in code1, close"></Keywords>
            <Keywords name="Folders in code2, open">if while foreach</Keywords>
            <Keywords name="Folders in code2, middle">elseif else</Keywords>
            <Keywords name="Folders in code2, close">endif endloop</Keywords>
            <Keywords name="Folders in comment, open"></Keywords>
            <Keywords name="Folders in comment, middle"></Keywords>
            <Keywords name="Folders in comment, close"></Keywords>
            <Keywords name="Keywords1">AddAccent AddAnchorClass AddAnchorPoint AddATT AddDHint AddExtrema AddHHint AddInstrs AddLookup AddLookupSubtable AddPosSub AddSizeFeature AddVHint ApplySubstitution Array AskUser ATan2 AutoCounter AutoHint AutoInstr AutoKern Autotrace AutoTrace AutoWidth bAutoCounter bDontAutoHint BitmapsAvail BitmapsRegen break bSubstitutionPoints BuildAccented BuildComposit BuildComposite BuildDuplicate CanonicalContours CanonicalStart Ceil CenterInWidth ChangePrivateEntry ChangeWeight CharCnt CharInfo CheckForAnchorClass Chr CIDChangeSubFont CIDFlatten CIDFlattenByCMap CIDSetFontNames Clear ClearBackground ClearCharCounterMasks ClearGlyphCounterMasks ClearHints ClearInstrs ClearPrivateEntry ClearTable Close CompareFonts CompareGlyphs ControlAfmLigatureOutput ConvertByCMap ConvertToCID Copy CopyAnchors CopyFgToBg CopyGlyphFeatures CopyLBearing CopyRBearing CopyReference CopyUnlinked CopyVWidth CopyWidth CorrectDirection Cos Cut DebugCrashFontForge DefaultATT DefaultOtherSubrs DefaultRoundToGrid DefaultUseMyMetrics DetachAndRemoveGlyphs DetachGlyphs DontAutoHint DrawsSomething Error Exp ExpandStroke Export FileAccess FindIntersections FindOrAddCvtIndex Floor FontImage FontsInFile Generate GenerateFamily GenerateFeatureFile GetAnchorPoints GetCvtAt GetEnv GetFontBoundingBox GetLookupInfo GetLookupOfSubtable GetLookups GetLookupSubtables GetMaxpValue GetOS2Value GetPosSub GetPref GetPrivateEntry GetSubtableOfAnchorClass GetTeXParam GetTTFName GlyphInfo HasPreservedTable HasPrivateEntry HFlip Import InFont Inline Int InterpolateFonts IsAlNum IsAlpha IsDigit IsFinite IsHexDigit IsLower IsNan IsSpace IsUpper Italic Join LoadEncodingFile LoadNamelist LoadNamelistDir LoadPlugin LoadPluginDir LoadPrefs LoadStringFromFile LoadTableFromFile Log LookupStoreLigatureInAfm MakeLine MergeFeature MergeFonts MergeKern MergeLookups MergeLookupSubtables MMAxisBounds MMAxisNames MMBlendToNewFont MMChangeInstance MMChangeWeight MMInstanceNames MMWeightedName Move MoveReference MultipleEncodingsToReferences NameFromUnicode NearlyHvCps NearlyHvLines NearlyLines New NonLinearTransform Open Ord Outline OverlapIntersect Paste PasteInto PasteWithOffset PositionReference PostNotice Pow PreloadCidmap Print PrintFont PrintSetup PrivateGuess PrivateToCvt Quit Rand ReadOtherSubrsFile Real Reencode RemoveAllKerns RemoveAllVKerns RemoveAnchorClass RemoveATT RemoveDetachedGlyphs RemoveLookup RemoveLookupSubtable RemoveOverlap RemovePosSub RemovePreservedTable RenameGlyphs ReplaceCharCounterMasks ReplaceCvtAt ReplaceGlyphCounterMasks ReplaceWithReference return Revert RevertToBackup Rotate Round RoundToCluster RoundToInt SameGlyphAs Save SavePrefs SaveTableToFile Scale ScaleToEm Select SelectAll SelectAllInstancesOf SelectBitmap SelectByATT SelectByColor SelectByColour SelectByPosSub SelectChanged SelectFewer SelectFewerSingletons SelectGlyphsBoth SelectGlyphsReferences SelectGlyphsSplines SelectHintingNeeded SelectIf SelectInvert SelectMore SelectMoreIf SelectMoreSingletons SelectMoreSingletonsIf SelectNone SelectSingletons SelectSingletonsIf SelectWorthOutputting SetCharCnt SetCharColor SetCharComment SetCharCounterMask SetCharName SetFeatureList SetFondName SetFontHasVerticalMetrics SetFontNames SetFontOrder SetGasp SetGlyphChanged SetGlyphClass SetGlyphColor SetGlyphComment SetGlyphCounterMask SetGlyphName SetGlyphTeX SetItalicAngle SetKern SetLBearing SetMacStyle SetMaxpValue SetOS2Value SetPanose SetPref SetPrefs SetRBearing SetTeXParams SetTTFName SetUnicodeValue SetUniqueID SetVKern SetVWidth SetWidth Shadow shift Simplify Sin SizeOf Skew SmallCaps Sqrt Strcasecmp Strcasestr Strftime StrJoin Strlen Strrstr Strskipint StrSplit Strstr Strsub Strtod Strtol SubstitutionPoints Tan ToLower ToMirror ToString ToUpper Transform TypeOf UCodePoint Ucs4 UnicodeAnnotationFromLib UnicodeBlockEndFromLib UnicodeBlockNameFromLib UnicodeBlockStartFromLib UnicodeFromName UnicodeNameFromLib UnicodeNamesListVersion UnlinkReference Utf8 Validate VFlip VKernFromHKern Wireframe WorthOutputting WritePfm WriteStringToFile</Keywords>
            <Keywords name="Keywords2">$argc $argv $curfont $firstfont $nextfont $fontchanged $fontname $familyname $fullname $fondname $weight $copyright $filename $fontversion $iscid $cidfontname $cidfamilyname $cidfullname $cidweight $cidcopyright $mmcount $italicangle $loadState $privateState $curcid $firstcid $nextcid $macstyle $bitmaps $order $em $ascent $descent $selection $panose $trace $version $haspython</Keywords>
            <Keywords name="Keywords3"></Keywords>
            <Keywords name="Keywords4"></Keywords>
            <Keywords name="Keywords5"></Keywords>
            <Keywords name="Keywords6"></Keywords>
            <Keywords name="Keywords7"></Keywords>
            <Keywords name="Keywords8"></Keywords>
            <Keywords name="Delimiters">00&quot; 00&apos; 01 02&quot; 02&apos; 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="NUMBERS" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS2" fgColor="FF8040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="OPERATORS" fgColor="000080" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="FOLDER IN CODE2" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
            <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS1" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
        </Styles>
    </UserLang>
</NotepadPlus>

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.