1if not modules then modules = { } end modules['s-fonts-goodies'] = { 2 version = 1.001, 3 comment = "companion to s-fonts-goodies.mkiv", 4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", 5 copyright = "PRAGMA ADE / ConTeXt Development Team", 6 license = "see context related readme files" 7} 8 9moduledata.fonts = moduledata.fonts or { } 10moduledata.fonts.goodies = moduledata.fonts.goodies or { } 11 12local NC, NR, HL = context.NC, context.NR, context.HL 13 14local function initialized(specification) 15 specification = interfaces.checkedspecification(specification) 16 local name = specification.name 17 if name then 18 local goodies = fonts.goodies.load(name) 19 if goodies then 20 return specification, goodies 21 end 22 end 23end 24 25function moduledata.fonts.goodies.showstylistics(specification) 26 local specification, goodies = initialized(specification) 27 if goodies then 28 local stylistics = goodies.stylistics 29 if stylistics then 30 context.starttabulate { "|Tl|Tpl|" } 31 HL() 32 NC() context.bold("feature") 33 NC() context.bold("meaning") 34 NC() NR() 35 HL() 36 for feature, meaning in table.sortedpairs(stylistics) do 37 NC() context(feature) 38 NC() context(string.lower(meaning)) 39 NC() NR() 40 end 41 HL() 42 context.stoptabulate() 43 end 44 end 45end 46 47function moduledata.fonts.goodies.showfeaturesets(specification) 48 local specification, goodies = initialized(specification) 49 if goodies then 50 local featuresets = goodies.featuresets 51 if featuresets then 52 context.starttabulate { "|Tl|Tpl|" } 53 HL() 54 NC() context.bold("featureset") 55 NC() context.bold("definitions") 56 NC() NR() 57 HL() 58 for featureset, definitions in table.sortedpairs(featuresets) do 59 NC() context.type(featureset) NC() 60 for k, v in table.sortedpairs(definitions) do 61 context("%s=%S",k,v) 62 context.quad() 63 end 64 NC() NR() 65 end 66 HL() 67 context.stoptabulate() 68 end 69 end 70end 71 72function moduledata.fonts.goodies.showcolorschemes(specification) 73 local specification, goodies = initialized(specification) 74 if goodies then 75 local colorschemes = goodies.colorschemes 76 if colorschemes then 77 context.starttabulate { "|Tl|Tpl|" } 78 HL() 79 NC() context.bold("colorscheme") 80 NC() context.bold("numbers") 81 NC() NR() 82 HL() 83 for colorscheme, numbers in table.sortedpairs(colorschemes) do 84 NC() context.type(colorscheme) NC() 85 for i=1,#numbers do 86 context(i) 87 context.quad() 88 end 89 NC() NR() 90 end 91 HL() 92 context.stoptabulate() 93 end 94 end 95end 96 97function moduledata.fonts.goodies.showfiles(specification) 98 local specification, goodies = initialized(specification) 99 if goodies then 100 local files = goodies.files 101 if files and files.list then 102 for filename, specification in table.sortedpairs(files.list) do 103 context.start() 104 context.dontleavehmode() 105 context.definedfont{ filename .. "*default" } 106 context("%s-%s-%s-%s-%s", 107 specification.name or files.name, 108 specification.weight or "normal", 109 specification.style or "normal", 110 specification.width or "normal", 111 specification.variant or "normal") 112 context.par() 113 context.stop() 114 end 115 end 116 end 117end 118 |