MCPcopy Create free account
hub / github.com/coldtype/st2 / ST2FontFeaturesPanel

Class ST2FontFeaturesPanel

ST2/font.py:179–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178
179class ST2FontFeaturesPanel(bpy.types.Panel):
180 bl_label = "Font Features"
181 bl_idname = "ST2_PT_33_FONTFEATURESPANEL"
182 bl_space_type = "VIEW_3D"
183 bl_region_type = "UI"
184 bl_category = "ST2"
185 bl_options = {'DEFAULT_CLOSED'}
186
187 @classmethod
188 def poll(cls, context):
189 return bool(search.active_key_object(context))
190
191 def draw(self, context):
192 ko = search.active_key_object(context)
193
194 layout = self.layout
195 data = ko.st2
196 font = data.font()
197
198 fi = 0
199 row = None
200
201 def show_fea(fea):
202 nonlocal fi, row
203 if fi%4 == 0 or row is None:
204 row = layout.row()
205
206 row.prop(data, f"fea_{fea}")
207 fi += 1
208
209 for fea in font.font.featuresGPOS:
210 if not hasattr(data, f"fea_{fea}"):
211 #print("!", fea)
212 pass
213 else:
214 show_fea(fea)
215
216 for fea in font.font.featuresGSUB:
217 if not fea.startswith("cv") and not fea.startswith("ss"):
218 if not hasattr(data, f"fea_{fea}"):
219 #print(fea)
220 pass
221 else:
222 show_fea(fea)
223
224 row = layout.row()
225 row.prop(data, "kerning_pairs", text="KP (dict)")
226 row.prop(data, "kerning_pairs_enabled", text="")
227
228 row.operator("st2.show_glyph_names", icon="EMPTY_AXIS", text="Show glyph names")
229
230
231classes = [

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected