Fix spec generation for auto setting

This commit is contained in:
Kovid Goyal
2024-06-02 09:41:24 +05:30
parent 02df66733e
commit 8e0ef0c430
3 changed files with 10 additions and 1 deletions

View File

@@ -131,6 +131,7 @@ def render_face_sample(font: Descriptor, opts: Options, dpi_x: float, dpi_y: flo
'psname': face.postscript_name(),
'features': get_features(face.get_features()),
'applied_features': face.applied_features(),
'spec': spec_for_face(font['family'], face).as_setting,
'cell_width': 0, 'cell_height': 0, 'canvas_height': 0, 'canvas_width': width,
}
if is_variable(font):

View File

@@ -33,8 +33,15 @@ func (self *face_panel) new_font_spec() (*FontSpec, error) {
if err != nil {
return nil, err
}
if fs.system.val == "auto" {
if fs, err = NewFontSpec(self.current_preview.Spec, self.current_preview.Features); err != nil {
return nil, err
}
}
fs.family = settable_string{self.family, true}
fs.variable_name = settable_string{self.current_preview.Variable_data.Variations_postscript_name_prefix, true}
if len(self.current_preview.Variable_data.Axes) > 0 {
fs.variable_name = settable_string{self.current_preview.Variable_data.Variations_postscript_name_prefix, true}
}
return &fs, nil
}

View File

@@ -106,6 +106,7 @@ type RenderedSampleTransmit struct {
Variable_data VariableData `json:"variable_data"`
Style string `json:"style"`
Psname string `json:"psname"`
Spec string `json:"spec"`
Features map[string]FeatureData `json:"features"`
Applied_features map[string]string `json:"applied_features"`
Variable_named_style NamedStyle `json:"variable_named_style"`