Skip to content

Commit 2ee523f

Browse files
committed
Merge branch 'feat/font-jetbrains-mono' into develop
# Conflicts: # CHANGELOG.md
2 parents a2d622c + 0c2816a commit 2ee523f

10 files changed

Lines changed: 288 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ API turns the open cycle into a minor.
8282
the correction is derived from font metrics (ascent, descent, leading, cap
8383
height), not a magic number. Render-only and opt-in — existing layouts are
8484
byte-for-byte unchanged.
85+
- **Bundled font: JetBrains Mono.** New `FontName.JETBRAINS_MONO` (`@since 1.7.0`)
86+
joins the built-in `DefaultFonts` catalog with its Regular / Bold / Italic /
87+
Bold-Italic faces (bundled from the OFL-1.1 release), so monospaced code and
88+
data blocks render without a system-font install. Usable through any
89+
`DocumentTextStyle.fontName(...)` and listed in the font showcase.
8590

8691
### Fixed
8792

src/main/java/com/demcha/compose/font/DefaultFonts.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public class DefaultFonts {
6161
google(FontName.SARABUN, "sarabun", "Sarabun"),
6262
google(FontName.PROMPT, "prompt", "Prompt"),
6363
google(FontName.ANDIKA, "andika", "Andika"),
64-
google(FontName.BAI_JAMJUREE, "baijamjuree", "BaiJamjuree"));
64+
google(FontName.BAI_JAMJUREE, "baijamjuree", "BaiJamjuree"),
65+
google(FontName.JETBRAINS_MONO, "jetbrainsmono", "JetBrainsMono"));
6566

6667
private DefaultFonts() {
6768
}

src/main/java/com/demcha/compose/font/FontName.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public final class FontName {
6161
public static final FontName PROMPT = of("Prompt");
6262
public static final FontName ANDIKA = of("Andika");
6363
public static final FontName BAI_JAMJUREE = of("Bai Jamjuree");
64+
public static final FontName JETBRAINS_MONO = of("JetBrains Mono");
6465

6566
private final String name;
6667
private final String normalizedName;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
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://scripts.sil.org/OFL
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.

src/test/java/com/demcha/compose/font/FontLibraryIntegrationTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void shouldExposeBundledGoogleFontsInEngineComposerHarness() throws Exception {
1919
try (EngineComposerHarness composer = com.demcha.compose.testsupport.EngineComposerHarness.pdf().create()) {
2020
assertThat(composer.availableFonts())
2121
.contains(FontName.HELVETICA, FontName.LATO, FontName.IBM_PLEX_SERIF, FontName.ZILLA_SLAB,
22-
FontName.KANIT, FontName.VOLKHOV, FontName.ANDIKA);
22+
FontName.KANIT, FontName.VOLKHOV, FontName.ANDIKA, FontName.JETBRAINS_MONO);
2323
}
2424

2525
try (PDDocument document = new PDDocument()) {
@@ -28,6 +28,8 @@ void shouldExposeBundledGoogleFontsInEngineComposerHarness() throws Exception {
2828
assertThat(fonts.getFont(FontName.LATO, WordFont.class)).isPresent();
2929
assertThat(fonts.getFont(FontName.KANIT, PdfFont.class)).isPresent();
3030
assertThat(fonts.getFont(FontName.KANIT, WordFont.class)).isPresent();
31+
assertThat(fonts.getFont(FontName.JETBRAINS_MONO, PdfFont.class)).isPresent();
32+
assertThat(fonts.getFont(FontName.JETBRAINS_MONO, WordFont.class)).isPresent();
3133
}
3234
}
3335

src/test/resources/layout-snapshots/fonts/available_fonts_preview.json

Lines changed: 184 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"depth" : 1,
2323
"layer" : 1,
2424
"computedX" : 28.0,
25-
"computedY" : -2711.974,
25+
"computedY" : -2822.154,
2626
"placementX" : 28.0,
27-
"placementY" : -2711.974,
27+
"placementY" : -2822.154,
2828
"placementWidth" : 442.2,
29-
"placementHeight" : 3525.864,
29+
"placementHeight" : 3636.044,
3030
"startPage" : 0,
3131
"endPage" : 4,
3232
"contentWidth" : 442.2,
33-
"contentHeight" : 3525.864,
33+
"contentHeight" : 3636.044,
3434
"margin" : {
3535
"top" : 0.0,
3636
"right" : 0.0,
@@ -5863,5 +5863,185 @@
58635863
"bottom" : 0.0,
58645864
"left" : 0.0
58655865
}
5866+
}, {
5867+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
5868+
"entityName" : "FontSection_JetBrains Mono",
5869+
"entityKind" : "SectionNode",
5870+
"parentPath" : "AvailableFontsPreview[0]",
5871+
"childIndex" : 34,
5872+
"depth" : 2,
5873+
"layer" : 2,
5874+
"computedX" : 28.0,
5875+
"computedY" : 302.083,
5876+
"placementX" : 28.0,
5877+
"placementY" : 302.083,
5878+
"placementWidth" : 442.2,
5879+
"placementHeight" : 86.18,
5880+
"startPage" : 4,
5881+
"endPage" : 4,
5882+
"contentWidth" : 442.2,
5883+
"contentHeight" : 86.18,
5884+
"margin" : {
5885+
"top" : 0.0,
5886+
"right" : 0.0,
5887+
"bottom" : 8.0,
5888+
"left" : 0.0
5889+
},
5890+
"padding" : {
5891+
"top" : 0.0,
5892+
"right" : 0.0,
5893+
"bottom" : 0.0,
5894+
"left" : 0.0
5895+
}
5896+
}, {
5897+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]/FontSection_JetBrains MonoTitle[0]",
5898+
"entityName" : "FontSection_JetBrains MonoTitle",
5899+
"entityKind" : "ParagraphNode",
5900+
"parentPath" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
5901+
"childIndex" : 0,
5902+
"depth" : 3,
5903+
"layer" : 3,
5904+
"computedX" : 28.0,
5905+
"computedY" : 377.163,
5906+
"placementX" : 28.0,
5907+
"placementY" : 377.163,
5908+
"placementWidth" : 90.012,
5909+
"placementHeight" : 11.1,
5910+
"startPage" : 4,
5911+
"endPage" : 4,
5912+
"contentWidth" : 90.012,
5913+
"contentHeight" : 11.1,
5914+
"margin" : {
5915+
"top" : 0.0,
5916+
"right" : 0.0,
5917+
"bottom" : 2.0,
5918+
"left" : 0.0
5919+
},
5920+
"padding" : {
5921+
"top" : 0.0,
5922+
"right" : 0.0,
5923+
"bottom" : 0.0,
5924+
"left" : 0.0
5925+
}
5926+
}, {
5927+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]/ParagraphNode[1]",
5928+
"entityName" : null,
5929+
"entityKind" : "ParagraphNode",
5930+
"parentPath" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
5931+
"childIndex" : 1,
5932+
"depth" : 3,
5933+
"layer" : 3,
5934+
"computedX" : 28.0,
5935+
"computedY" : 358.643,
5936+
"placementX" : 28.0,
5937+
"placementY" : 358.643,
5938+
"placementWidth" : 415.8,
5939+
"placementHeight" : 14.52,
5940+
"startPage" : 4,
5941+
"endPage" : 4,
5942+
"contentWidth" : 415.8,
5943+
"contentHeight" : 14.52,
5944+
"margin" : {
5945+
"top" : 0.0,
5946+
"right" : 0.0,
5947+
"bottom" : 1.0,
5948+
"left" : 0.0
5949+
},
5950+
"padding" : {
5951+
"top" : 0.0,
5952+
"right" : 0.0,
5953+
"bottom" : 0.0,
5954+
"left" : 0.0
5955+
}
5956+
}, {
5957+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]/ParagraphNode[2]",
5958+
"entityName" : null,
5959+
"entityKind" : "ParagraphNode",
5960+
"parentPath" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
5961+
"childIndex" : 2,
5962+
"depth" : 3,
5963+
"layer" : 3,
5964+
"computedX" : 28.0,
5965+
"computedY" : 341.123,
5966+
"placementX" : 28.0,
5967+
"placementY" : 341.123,
5968+
"placementWidth" : 396.0,
5969+
"placementHeight" : 14.52,
5970+
"startPage" : 4,
5971+
"endPage" : 4,
5972+
"contentWidth" : 396.0,
5973+
"contentHeight" : 14.52,
5974+
"margin" : {
5975+
"top" : 0.0,
5976+
"right" : 0.0,
5977+
"bottom" : 1.0,
5978+
"left" : 0.0
5979+
},
5980+
"padding" : {
5981+
"top" : 0.0,
5982+
"right" : 0.0,
5983+
"bottom" : 0.0,
5984+
"left" : 0.0
5985+
}
5986+
}, {
5987+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]/ParagraphNode[3]",
5988+
"entityName" : null,
5989+
"entityKind" : "ParagraphNode",
5990+
"parentPath" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
5991+
"childIndex" : 3,
5992+
"depth" : 3,
5993+
"layer" : 3,
5994+
"computedX" : 28.0,
5995+
"computedY" : 323.603,
5996+
"placementX" : 28.0,
5997+
"placementY" : 323.603,
5998+
"placementWidth" : 409.2,
5999+
"placementHeight" : 14.52,
6000+
"startPage" : 4,
6001+
"endPage" : 4,
6002+
"contentWidth" : 409.2,
6003+
"contentHeight" : 14.52,
6004+
"margin" : {
6005+
"top" : 0.0,
6006+
"right" : 0.0,
6007+
"bottom" : 1.0,
6008+
"left" : 0.0
6009+
},
6010+
"padding" : {
6011+
"top" : 0.0,
6012+
"right" : 0.0,
6013+
"bottom" : 0.0,
6014+
"left" : 0.0
6015+
}
6016+
}, {
6017+
"path" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]/ParagraphNode[4]",
6018+
"entityName" : null,
6019+
"entityKind" : "ParagraphNode",
6020+
"parentPath" : "AvailableFontsPreview[0]/FontSection_JetBrains Mono[34]",
6021+
"childIndex" : 4,
6022+
"depth" : 3,
6023+
"layer" : 3,
6024+
"computedX" : 28.0,
6025+
"computedY" : 306.083,
6026+
"placementX" : 28.0,
6027+
"placementY" : 306.083,
6028+
"placementWidth" : 442.2,
6029+
"placementHeight" : 14.52,
6030+
"startPage" : 4,
6031+
"endPage" : 4,
6032+
"contentWidth" : 442.2,
6033+
"contentHeight" : 14.52,
6034+
"margin" : {
6035+
"top" : 0.0,
6036+
"right" : 0.0,
6037+
"bottom" : 4.0,
6038+
"left" : 0.0
6039+
},
6040+
"padding" : {
6041+
"top" : 0.0,
6042+
"right" : 0.0,
6043+
"bottom" : 0.0,
6044+
"left" : 0.0
6045+
}
58666046
} ]
58676047
}

0 commit comments

Comments
 (0)