diff --git a/assets/scss/fonts.scss b/assets/scss/fonts.scss index 1061b86..f4502c3 100644 --- a/assets/scss/fonts.scss +++ b/assets/scss/fonts.scss @@ -4,7 +4,7 @@ font-display: swap; font-weight: $weight; src: local('Inconsolata'), - url('../fonts/Inconsolata-VariableFont_wdth,wght.ttf'); + url('../fonts/gen/Inconsolata-#{$weight}.woff2'); } } @@ -13,8 +13,8 @@ font-family: 'Lora'; font-display: swap; src: local('Lora'), - url('../fonts/Lora-VariableFont_wght.ttf'), - url('../fonts/Lora-Italic-VariableFont_wght.ttf'); + url('../fonts/gen/Lora-Regular.woff2'), + url('../fonts/gen/Lora-Italic.woff2'); } } @@ -24,8 +24,8 @@ font-display: swap; font-weight: $weight; src: local('Raleway'), - url('../fonts/Raleway-VariableFont_wght.ttf'), - url('../fonts/Raleway-Italic-VariableFont_wght.ttf'); + url('../fonts/gen/Raleway-#{$weight}.woff2'), + url('../fonts/gen/Raleway-#{$weight}-Italic.woff2'); } } diff --git a/chatgpt-instance-fonts.py b/chatgpt-instance-fonts.py new file mode 100644 index 0000000..f9dc4b2 --- /dev/null +++ b/chatgpt-instance-fonts.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 + +""" +Instantiate variable fonts at specific weights/styles, producing static TTF files. +No subsetting, no recursive searching—just direct calls with hardcoded axis values. +Requires fontTools >= 4.0. + +Genererated by ChatGTP o3-mini-high. Not human-modified. +""" + +from fontTools.ttLib import TTFont +from fontTools.varLib.instancer import instantiateVariableFont + +def instantiate_variable_font(input_font_path, axis_values, output_font_path): + """ + 1) Loads a variable font from `input_font_path`. + 2) Instantiates (flattens) it at the specified axis values (e.g. {"wght": 400}). + 3) Saves the result as a static TTF at `output_font_path`. + """ + print(f"Instantiating {input_font_path} with axes={axis_values} -> {output_font_path}") + vf = TTFont(input_font_path) + static_font = instantiateVariableFont(vf, axis_values) + static_font.flavor = "woff2" + static_font.save(output_font_path) + +def main(): + # Inconsolata (Variable) + instantiate_variable_font( + "Inconsolata-VariableFont_wdth,wght.ttf", + {"wght": 400}, + "Inconsolata-400.woff2" + ) + instantiate_variable_font( + "Inconsolata-VariableFont_wdth,wght.ttf", + {"wght": 700}, + "Inconsolata-700.woff2" + ) + + # Lora (Variable, normal and italic) + instantiate_variable_font( + "Lora-VariableFont_wght.ttf", + {"wght": 400}, + "Lora-Regular.woff2" + ) + instantiate_variable_font( + "Lora-Italic-VariableFont_wght.ttf", + {"wght": 400}, + "Lora-Italic.woff2" + ) + + # Raleway (Variable, normal and italic) + instantiate_variable_font( + "Raleway-VariableFont_wght.ttf", + {"wght": 400}, + "Raleway-400.woff2" + ) + instantiate_variable_font( + "Raleway-VariableFont_wght.ttf", + {"wght": 700}, + "Raleway-700.woff2" + ) + instantiate_variable_font( + "Raleway-Italic-VariableFont_wght.ttf", + {"wght": 400}, + "Raleway-400-Italic.woff2" + ) + instantiate_variable_font( + "Raleway-Italic-VariableFont_wght.ttf", + {"wght": 700}, + "Raleway-700-Italic.woff2" + ) + +if __name__ == "__main__": + main() diff --git a/static/fonts/gen/Inconsolata-400.woff2 b/static/fonts/gen/Inconsolata-400.woff2 new file mode 100644 index 0000000..dbdab6e Binary files /dev/null and b/static/fonts/gen/Inconsolata-400.woff2 differ diff --git a/static/fonts/gen/Inconsolata-700.woff2 b/static/fonts/gen/Inconsolata-700.woff2 new file mode 100644 index 0000000..d9b9e2c Binary files /dev/null and b/static/fonts/gen/Inconsolata-700.woff2 differ diff --git a/static/fonts/gen/Lora-Italic.woff2 b/static/fonts/gen/Lora-Italic.woff2 new file mode 100644 index 0000000..8a8d66a Binary files /dev/null and b/static/fonts/gen/Lora-Italic.woff2 differ diff --git a/static/fonts/gen/Lora-Regular.woff2 b/static/fonts/gen/Lora-Regular.woff2 new file mode 100644 index 0000000..0ac2bcc Binary files /dev/null and b/static/fonts/gen/Lora-Regular.woff2 differ diff --git a/static/fonts/gen/Raleway-400-Italic.woff2 b/static/fonts/gen/Raleway-400-Italic.woff2 new file mode 100644 index 0000000..8e569ae Binary files /dev/null and b/static/fonts/gen/Raleway-400-Italic.woff2 differ diff --git a/static/fonts/gen/Raleway-400.woff2 b/static/fonts/gen/Raleway-400.woff2 new file mode 100644 index 0000000..fbe1a9e Binary files /dev/null and b/static/fonts/gen/Raleway-400.woff2 differ diff --git a/static/fonts/gen/Raleway-700-Italic.woff2 b/static/fonts/gen/Raleway-700-Italic.woff2 new file mode 100644 index 0000000..b073d9a Binary files /dev/null and b/static/fonts/gen/Raleway-700-Italic.woff2 differ diff --git a/static/fonts/gen/Raleway-700.woff2 b/static/fonts/gen/Raleway-700.woff2 new file mode 100644 index 0000000..24acf4e Binary files /dev/null and b/static/fonts/gen/Raleway-700.woff2 differ