Skip to content

Commit 64bdcbd

Browse files
authored
Merge pull request #15 from saivivek116/feat/configurable-resume-fonts
configurable font styles
2 parents 6437e21 + b2ea717 commit 64bdcbd

20 files changed

Lines changed: 476 additions & 37 deletions

public/fonts/Carlito-Bold.ttf

666 KB
Binary file not shown.

public/fonts/Carlito-Italic.ttf

601 KB
Binary file not shown.

public/fonts/Carlito-OFL.txt

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Copyright 2013 The Carlito Project Authors (https://github.com/googlefonts/carlito), with Reserved Font Name "Carlito"
2+
3+
4+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
5+
This license is copied below, and is also available with a FAQ at:
6+
https://scripts.sil.org/OFL
7+
8+
9+
-----------------------------------------------------------
10+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11+
-----------------------------------------------------------
12+
13+
PREAMBLE
14+
The goals of the Open Font License (OFL) are to stimulate worldwide
15+
development of collaborative font projects, to support the font creation
16+
efforts of academic and linguistic communities, and to provide a free and
17+
open framework in which fonts may be shared and improved in partnership
18+
with others.
19+
20+
The OFL allows the licensed fonts to be used, studied, modified and
21+
redistributed freely as long as they are not sold by themselves. The
22+
fonts, including any derivative works, can be bundled, embedded,
23+
redistributed and/or sold with any software provided that any reserved
24+
names are not used by derivative works. The fonts and derivatives,
25+
however, cannot be released under any other type of license. The
26+
requirement for fonts to remain under this license does not apply
27+
to any document created using the fonts or their derivatives.
28+
29+
DEFINITIONS
30+
"Font Software" refers to the set of files released by the Copyright
31+
Holder(s) under this license and clearly marked as such. This may
32+
include source files, build scripts and documentation.
33+
34+
"Reserved Font Name" refers to any names specified as such after the
35+
copyright statement(s).
36+
37+
"Original Version" refers to the collection of Font Software components as
38+
distributed by the Copyright Holder(s).
39+
40+
"Modified Version" refers to any derivative made by adding to, deleting,
41+
or substituting -- in part or in whole -- any of the components of the
42+
Original Version, by changing formats or by porting the Font Software to a
43+
new environment.
44+
45+
"Author" refers to any designer, engineer, programmer, technical
46+
writer or other person who contributed to the Font Software.
47+
48+
PERMISSION & CONDITIONS
49+
Permission is hereby granted, free of charge, to any person obtaining
50+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
51+
redistribute, and sell modified and unmodified copies of the Font
52+
Software, subject to the following conditions:
53+
54+
1) Neither the Font Software nor any of its individual components,
55+
in Original or Modified Versions, may be sold by itself.
56+
57+
2) Original or Modified Versions of the Font Software may be bundled,
58+
redistributed and/or sold with any software, provided that each copy
59+
contains the above copyright notice and this license. These can be
60+
included either as stand-alone text files, human-readable headers or
61+
in the appropriate machine-readable metadata fields within text or
62+
binary files as long as those fields can be easily viewed by the user.
63+
64+
3) No Modified Version of the Font Software may use the Reserved Font
65+
Name(s) unless explicit written permission is granted by the corresponding
66+
Copyright Holder. This restriction only applies to the primary font name as
67+
presented to the users.
68+
69+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70+
Software shall not be used to promote, endorse or advertise any
71+
Modified Version, except to acknowledge the contribution(s) of the
72+
Copyright Holder(s) and the Author(s) or with their explicit written
73+
permission.
74+
75+
5) The Font Software, modified or unmodified, in part or in whole,
76+
must be distributed entirely under this license, and must not be
77+
distributed under any other license. The requirement for fonts to
78+
remain under this license does not apply to any document created
79+
using the Font Software.
80+
81+
TERMINATION
82+
This license becomes null and void if any of the above conditions are
83+
not met.
84+
85+
DISCLAIMER
86+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94+
OTHER DEALINGS IN THE FONT SOFTWARE.

public/fonts/Carlito-Regular.ttf

613 KB
Binary file not shown.

public/fonts/EBGaramond-Bold.ttf

53.3 KB
Binary file not shown.

public/fonts/EBGaramond-Italic.ttf

53.5 KB
Binary file not shown.

public/fonts/EBGaramond-OFL.txt

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2017 The EB Garamond Project Authors (https://github.com/octaviopardo/EBGaramond12)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
https://openfontlicense.org
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
53.1 KB
Binary file not shown.

schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ CREATE TABLE IF NOT EXISTS public.resumes (
120120
updated_at timestamp with time zone NOT NULL DEFAULT timezone('utc'::text, now()),
121121
resume_title text NULL,
122122
target_role text NULL,
123-
document_settings jsonb NULL DEFAULT '{"header_name_size": 24, "skills_margin_top": 2, "document_font_size": 10, "projects_margin_top": 2, "skills_item_spacing": 2, "document_line_height": 1.5, "education_margin_top": 2, "skills_margin_bottom": 2, "experience_margin_top": 2, "projects_item_spacing": 4, "education_item_spacing": 4, "projects_margin_bottom": 2, "education_margin_bottom": 2, "experience_item_spacing": 4, "document_margin_vertical": 36, "experience_margin_bottom": 2, "skills_margin_horizontal": 0, "document_margin_horizontal": 36, "header_name_bottom_spacing": 24, "projects_margin_horizontal": 0, "education_margin_horizontal": 0, "experience_margin_horizontal": 0}'::jsonb,
123+
document_settings jsonb NULL DEFAULT '{"document_font_family": "helvetica", "header_name_size": 24, "skills_margin_top": 2, "document_font_size": 10, "projects_margin_top": 2, "skills_item_spacing": 2, "document_line_height": 1.5, "education_margin_top": 2, "skills_margin_bottom": 2, "experience_margin_top": 2, "projects_item_spacing": 4, "education_item_spacing": 4, "projects_margin_bottom": 2, "education_margin_bottom": 2, "experience_item_spacing": 4, "document_margin_vertical": 36, "experience_margin_bottom": 2, "skills_margin_horizontal": 0, "document_margin_horizontal": 36, "header_name_bottom_spacing": 24, "projects_margin_horizontal": 0, "education_margin_horizontal": 0, "experience_margin_horizontal": 0}'::jsonb,
124124
has_cover_letter boolean NOT NULL DEFAULT false,
125125
cover_letter jsonb NULL,
126126
CONSTRAINT resumes_pkey PRIMARY KEY (id),

src/components/cover-letter/cover-letter-pdf-document.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Resume, CoverLetterDocumentSettings, DEFAULT_COVER_LETTER_SETTINGS } fr
44
import { Document as PDFDocument, Page as PDFPage, Text, View, StyleSheet, Link } from '@react-pdf/renderer';
55
import { memo, useMemo } from 'react';
66
import { parseCoverLetterHtml } from '@/lib/cover-letter-html-parser';
7+
import { registerResumeFonts, getPdfFonts } from '@/lib/fonts/resume-fonts';
8+
9+
// Register embeddable fonts (Carlito, EB Garamond) once at module load.
10+
registerResumeFonts();
711

812
export { DEFAULT_COVER_LETTER_SETTINGS };
913

@@ -26,16 +30,20 @@ function createCoverLetterStyles(settings: CoverLetterDocumentSettings = DEFAULT
2630
margin_horizontal = 72,
2731
header_name_size = 24,
2832
paragraph_spacing = 12,
33+
document_font_family,
2934
} = settings;
3035

36+
// Resolve the PDF font-family names for the selected font (defaults to Helvetica).
37+
const font = getPdfFonts(document_font_family);
38+
3139
return StyleSheet.create({
3240
...baseStyles,
3341
page: {
3442
paddingTop: margin_vertical,
3543
paddingBottom: margin_vertical,
3644
paddingLeft: margin_horizontal,
3745
paddingRight: margin_horizontal,
38-
fontFamily: 'Helvetica',
46+
fontFamily: font.regular,
3947
color: '#111827',
4048
fontSize: font_size,
4149
lineHeight: line_height,
@@ -45,7 +53,7 @@ function createCoverLetterStyles(settings: CoverLetterDocumentSettings = DEFAULT
4553
},
4654
name: {
4755
fontSize: header_name_size,
48-
fontFamily: 'Helvetica-Bold',
56+
fontFamily: font.bold,
4957
marginBottom: 8,
5058
color: '#111827',
5159
textAlign: 'center',
@@ -71,10 +79,10 @@ function createCoverLetterStyles(settings: CoverLetterDocumentSettings = DEFAULT
7179
marginBottom: paragraph_spacing,
7280
},
7381
bold: {
74-
fontFamily: 'Helvetica-Bold',
82+
fontFamily: font.bold,
7583
},
7684
italic: {
77-
fontFamily: 'Helvetica-Oblique',
85+
fontFamily: font.italic,
7886
},
7987
underline: {
8088
textDecoration: 'underline',

0 commit comments

Comments
 (0)