Use PSname in faces preview panel

This commit is contained in:
Kovid Goyal
2024-05-14 15:35:43 +05:30
parent fc72f4961e
commit 82ffb376b2
3 changed files with 8 additions and 6 deletions

View File

@@ -85,6 +85,7 @@ def render_face_sample(font: Descriptor, opts: Options, dpi_x: float, dpi_y: flo
metadata = {
'variable_data': get_variable_data_for_face(face),
'style': font['style'],
'psname': face.postscript_name(),
}
if is_variable(font):
ns = get_named_style(face)

View File

@@ -71,12 +71,12 @@ func (self *faces) draw_screen() (err error) {
}
slot := 0
d := func(setting, title, setting_val string) {
d := func(setting, title string) {
if int(sz.HeightCells)-y < num_lines+1 {
return
}
lp.MoveCursorTo(1, y+1)
_, y, str = self.handler.render_lines.InRectangle([]string{title + fmt.Sprintf(" (%s %s)", setting, setting_val)}, 0, y, int(sz.WidthCells), int(sz.HeightCells), &self.handler.mouse_state, self.on_click)
_, y, str = self.handler.render_lines.InRectangle([]string{title + " - " + previews[setting].Psname}, 0, y, int(sz.WidthCells), int(sz.HeightCells), &self.handler.mouse_state, self.on_click)
lp.QueueWriteString(str)
if y+num_lines < int(sz.HeightCells) {
lp.MoveCursorTo(1, y+1)
@@ -85,10 +85,10 @@ func (self *faces) draw_screen() (err error) {
y += num_lines + 1
}
}
d(`font_family`, styled("fg=magenta bold", "R")+`egular`, key.settings.font_family)
d(`bold_font`, styled("fg=magenta bold", "B")+`old`, key.settings.bold_font)
d(`italic_font`, styled("fg=magenta bold", "I")+`talic`, key.settings.italic_font)
d(`bold_italic_font`, "B"+styled("fg=magenta bold", "o")+`ld-Italic`, key.settings.bold_italic_font)
d(`font_family`, styled("fg=magenta bold", "R")+`egular`)
d(`bold_font`, styled("fg=magenta bold", "B")+`old`)
d(`italic_font`, styled("fg=magenta bold", "I")+`talic`)
d(`bold_italic_font`, "B"+styled("fg=magenta bold", "o")+`ld-Italic`)
return
}

View File

@@ -90,6 +90,7 @@ type RenderedSampleTransmit struct {
Path string `json:"path"`
Variable_data VariableData `json:"variable_data"`
Style string `json:"style"`
Psname string `json:"psname"`
Variable_named_style NamedStyle `json:"variable_named_style"`
Variable_axis_map map[string]float64 `json:"variable_axis_map"`
}