diff --git a/rendercv/themes/__init__.py b/rendercv/themes/__init__.py index 1978768..ed82a9f 100644 --- a/rendercv/themes/__init__.py +++ b/rendercv/themes/__init__.py @@ -180,10 +180,23 @@ class ThemeOptions(pydantic.BaseModel): duplication. """ - theme: Literal["tobeoverwritten"] - model_config = pydantic.ConfigDict(extra="forbid") + theme: Literal["tobeoverwritten"] + + font: Literal[ + "Latin Modern Serif", + "Latin Modern Sans Serif", + "Latin Modern Mono", + "Source Sans 3", + "Charter", + ] = pydantic.Field( + default="Latin Modern Serif", + title="Font", + description=( + "The font family of the CV. The default value is Latin Modern Serif." + ), + ) font_size: Literal["10pt", "11pt", "12pt"] = pydantic.Field( default="10pt", title="Font Size", diff --git a/rendercv/themes/classic/Preamble.j2.tex b/rendercv/themes/classic/Preamble.j2.tex index b0a37f1..8989b2f 100644 --- a/rendercv/themes/classic/Preamble.j2.tex +++ b/rendercv/themes/classic/Preamble.j2.tex @@ -34,17 +34,27 @@ \usepackage{needspace} % for avoiding page brake right after the section title \usepackage{iftex} % check if engine is pdflatex, xetex or luatex -% Theme specific: -\usepackage[default, type1]{sourcesanspro} % for using source sans 3 font - % Ensure that generate pdf is machine readable/ATS parsable: \ifPDFTeX \input{glyphtounicode} \pdfgentounicode=1 \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} + \usepackage{lmodern} \fi +((* if design.font == "Latin Modern Serif" *)) + +((* elif design.font == "Latin Modern Sans Serif" *)) +\renewcommand{\familydefault}{\sfdefault} +((* elif design.font == "Latin Modern Mono" *)) +\renewcommand{\familydefault}{\ttdefault} +((* elif design.font == "Source Sans 3" *)) +\usepackage[default, type1]{sourcesanspro} +((* elif design.font == "Charter" *)) +\usepackage{charter} +((* endif *)) + % Some settings: ((* if design.text_alignment == "justified-with-no-hyphenation" *)) \usepackage[none]{hyphenat} diff --git a/rendercv/themes/classic/__init__.py b/rendercv/themes/classic/__init__.py index 96e7f87..59fcddd 100644 --- a/rendercv/themes/classic/__init__.py +++ b/rendercv/themes/classic/__init__.py @@ -32,6 +32,17 @@ class ClassicThemeOptions(ThemeOptions): """This class is the data model of the theme options for the `classic` theme.""" theme: Literal["classic"] + font: Literal[ + "Latin Modern Serif", + "Latin Modern Sans Serif", + "Latin Modern Mono", + "Source Sans 3", + "Charter", + ] = pydantic.Field( + default="Source Sans 3", + title="Font", + description="The font family of the CV. The default value is Source Sans 3.", + ) show_timespan_in: list[str] = pydantic.Field( default=[], title="Show Time Span in These Sections", diff --git a/rendercv/themes/engineeringresumes/Preamble.j2.tex b/rendercv/themes/engineeringresumes/Preamble.j2.tex index 477d995..624a75b 100644 --- a/rendercv/themes/engineeringresumes/Preamble.j2.tex +++ b/rendercv/themes/engineeringresumes/Preamble.j2.tex @@ -34,17 +34,27 @@ \usepackage{needspace} % for avoiding page brake right after the section title \usepackage{iftex} % check if engine is pdflatex, xetex or luatex -% Theme specific: -\usepackage{charter} % for using charter font - % Ensure that generate pdf is machine readable/ATS parsable: \ifPDFTeX \input{glyphtounicode} \pdfgentounicode=1 \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} + \usepackage{lmodern} \fi +((* if design.font == "Latin Modern Serif" *)) + +((* elif design.font == "Latin Modern Sans Serif" *)) +\renewcommand{\familydefault}{\sfdefault} +((* elif design.font == "Latin Modern Mono" *)) +\renewcommand{\familydefault}{\ttdefault} +((* elif design.font == "Source Sans 3" *)) +\usepackage[default, type1]{sourcesanspro} +((* elif design.font == "Charter" *)) +\usepackage{charter} +((* endif *)) + % Some settings: ((* if design.text_alignment == "justified-with-no-hyphenation" *)) \usepackage[none]{hyphenat} diff --git a/rendercv/themes/engineeringresumes/__init__.py b/rendercv/themes/engineeringresumes/__init__.py index 0a74007..0716900 100644 --- a/rendercv/themes/engineeringresumes/__init__.py +++ b/rendercv/themes/engineeringresumes/__init__.py @@ -100,6 +100,17 @@ class EngineeringresumesThemeOptions(ThemeOptions): """ theme: Literal["engineeringresumes"] + font: Literal[ + "Latin Modern Serif", + "Latin Modern Sans Serif", + "Latin Modern Mono", + "Source Sans 3", + "Charter", + ] = pydantic.Field( + default="Charter", + title="Font", + description="The font family of the CV. The default value is Charter.", + ) header_font_size: LaTeXDimension = pydantic.Field( default="25 pt", title="Header Font Size", diff --git a/rendercv/themes/sb2nov/Preamble.j2.tex b/rendercv/themes/sb2nov/Preamble.j2.tex index 56f27b5..b02f72d 100644 --- a/rendercv/themes/sb2nov/Preamble.j2.tex +++ b/rendercv/themes/sb2nov/Preamble.j2.tex @@ -40,8 +40,21 @@ \pdfgentounicode=1 % \usepackage[T1]{fontenc} % this breaks sb2nov \usepackage[utf8]{inputenc} + \usepackage{lmodern} \fi +((* if design.font == "Latin Modern Serif" *)) + +((* elif design.font == "Latin Modern Sans Serif" *)) +\renewcommand{\familydefault}{\sfdefault} +((* elif design.font == "Latin Modern Mono" *)) +\renewcommand{\familydefault}{\ttdefault} +((* elif design.font == "Source Sans 3" *)) +\usepackage[default, type1]{sourcesanspro} +((* elif design.font == "Charter" *)) +\usepackage{charter} +((* endif *)) + % Some settings: ((* if design.text_alignment == "justified-with-no-hyphenation" *)) \usepackage[none]{hyphenat} diff --git a/rendercv/themes/sb2nov/__init__.py b/rendercv/themes/sb2nov/__init__.py index 131737b..6be073f 100644 --- a/rendercv/themes/sb2nov/__init__.py +++ b/rendercv/themes/sb2nov/__init__.py @@ -31,6 +31,19 @@ class Sb2novThemeOptions(ThemeOptions): """This class is the data model of the theme options for the `sb2nov` theme.""" theme: Literal["sb2nov"] + font: Literal[ + "Latin Modern Serif", + "Latin Modern Sans Serif", + "Latin Modern Mono", + "Source Sans 3", + "Charter", + ] = pydantic.Field( + default="Latin Modern Serif", + title="Font", + description=( + "The font family of the CV. The default value is Latin Modern Serif." + ), + ) header_font_size: LaTeXDimension = pydantic.Field( default="24 pt", title="Header Font Size",