Skip to content

Commit

Permalink
Merge pull request #256 from KevinBatdorf/add-retro-fonts
Browse files Browse the repository at this point in the history
Add retro fonts
  • Loading branch information
KevinBatdorf authored Nov 12, 2023
2 parents 94bad7d + b489f4e commit 9ea5f63
Show file tree
Hide file tree
Showing 16 changed files with 540 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cypress/e2e/themes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ context('Theme checks', () => {
});

it('Themes can be disabled and hidden from view', () => {
cy.openSideBarPanel('Themes');
cy.openSideBarPanel('Theme');
cy.get('div[aria-label="Editor settings"] button')
.contains('Themes')
.contains('Theme')
.parents('.interface-interface-skeleton__sidebar')
.scrollTo('bottom');
cy.get('#code-block-pro-theme-nord').should('exist');
Expand All @@ -59,15 +59,15 @@ context('Theme checks', () => {
});

it('Themes can be filtered via search', () => {
cy.openSideBarPanel('Themes');
cy.openSideBarPanel('Theme');
cy.get('#code-block-pro-theme-monokai').should('exist');
cy.get('#code-block-pro-search-themes').type('monokai');
cy.get('#code-block-pro-theme-monokai').should('exist');
cy.get('#code-block-pro-theme-dracula').should('not.exist');
});

it('Themes CTA shows twice in panel and once in modal', () => {
cy.openSideBarPanel('Themes');
cy.openSideBarPanel('Theme');
cy.get(`[href^="${MORE_THEMES_URL}"]`).should('have.length', 2);
cy.get('[data-cy="manage-themes"]').should('exist').click();
cy.get(`[href^="${MORE_THEMES_URL}"]`).should('exist');
Expand All @@ -81,7 +81,7 @@ context('Theme checks', () => {
'testing-testing',
() => ({ nord: { name: 'Nord', priority: true } }),
);
cy.openSideBarPanel('Themes');
cy.openSideBarPanel('Theme');
cy.get(`[href^="${MORE_THEMES_URL}"]`).should('not.exist');
cy.get('[data-cy="manage-themes"]').should('exist').click();
cy.get(`[href^="${MORE_THEMES_URL}"]`).should('not.exist');
Expand Down
6 changes: 3 additions & 3 deletions cypress/support/features/theme.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const setTheme = (theme) => {
cy.openBlockSettingsSideBar();
cy.openSideBarPanel('Themes');
cy.openSideBarPanel('Theme');
cy.get('div[aria-label="Editor settings"] button')
.contains('Themes')
.contains('Theme')
.parents('.interface-interface-skeleton__sidebar')
.scrollTo('bottom', {
duration: 300,
});
cy.get(`#code-block-pro-theme-${theme}`).should('exist');
cy.get('div[aria-label="Editor settings"] button')
.contains('Themes')
.contains('Theme')
.parents('.interface-interface-skeleton__sidebar')
.scrollTo('top', {
duration: 300,
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ Themes are rendered inside the editor as you type or make changes, so the code b

== Changelog ==

- Feature: Added two new programming fonts, Cozette and Deja Vu
- Feature: Add pluggable sidebar slots to allow others to add functionality
- Tweak: Renamed Themes to Theme and moved it to the top
- Legal: Added (open source) license files for all fonts

= 1.24.1 - 2023-10-11 =
- Tweak: Line numbers width is now calculated based on the longest line number * font width
Expand Down
2 changes: 2 additions & 0 deletions src/editor/components/FontSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ export const FontFamilySelect = ({
'Code-Pro-Fira-Code': 'Fira Code',
'Code-Pro-JetBrains-Mono': 'JetBrains Mono',
'Code-Pro-JetBrains-Mono-NL.ttf': 'JetBrains Mono (No Ligatures)',
'Code-Pro-Cozette': 'Cozette',
'Code-Pro-Deja-Vu-Mono.ttf': 'DejaVu Mono',
'': __('System Default', 'code-block-pro'),
};
return (
Expand Down
2 changes: 1 addition & 1 deletion src/editor/components/ThemesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const ThemesPanel = ({
const ready = useSettingsStoreReady();
return (
<PanelBody
title={__('Themes', 'code-block-pro')}
title={__('Theme', 'code-block-pro')}
initialOpen={bringAttentionToThemes ?? false}>
{ready && <ThemeFilter search={search} setSearch={setSearch} />}
{ready && (
Expand Down
10 changes: 5 additions & 5 deletions src/editor/controls/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export const SidebarControls = ({
attributes={attributes}
setAttributes={setAttributes}
/>
<ThemesPanel
bringAttentionToThemes={bringAttention === 'theme-select'}
attributes={attributes}
setAttributes={setAttributes}
/>
<PanelBody
title={__('Language', 'code-block-pro')}
initialOpen={bringAttention === 'language-select'}>
Expand Down Expand Up @@ -134,11 +139,6 @@ export const SidebarControls = ({
</BaseControl>
</div>
</PanelBody>
<ThemesPanel
bringAttentionToThemes={bringAttention === 'theme-select'}
attributes={attributes}
setAttributes={setAttributes}
/>
<PanelBody
title={__('Header Type', 'code-block-pro')}
initialOpen={false}>
Expand Down
8 changes: 8 additions & 0 deletions src/editor/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,11 @@
font-family: 'Code-Pro-Fantasque-Sans-Mono';
src: url('../fonts/Code-Pro-Fantasque-Sans-Mono.woff2') format('woff2');
}
@font-face {
font-family: 'Code-Pro-Cozette';
src: url('../fonts/Code-Pro-Cozette.woff2') format('woff2');
}
@font-face {
font-family: 'Code-Pro-Deja-Vu-Mono';
src: url('../fonts/Code-Pro-Deja-Vu-Mono.ttf') format('truetype');
}
Binary file added src/fonts/Code-Pro-Cozette.woff2
Binary file not shown.
Binary file added src/fonts/Code-Pro-Deja-Vu-Mono.ttf
Binary file not shown.
22 changes: 22 additions & 0 deletions src/fonts/licenses/Comic Mono.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Original work Copyright (c) 2018 Shannon Miwa
Modified work Copyright (c) 2019 dtinth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions src/fonts/licenses/Cozette.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020, Slavfox

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
187 changes: 187 additions & 0 deletions src/fonts/licenses/Deja-Vu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)


Bitstream Vera Fonts Copyright
------------------------------

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:

The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".

This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.

The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.

Arev Fonts Copyright
------------------------------

Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:

The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.

The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".

This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.

The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.

TeX Gyre DJV Math
-----------------
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.

Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
(on behalf of TeX users groups) are in public domain.

Letters imported from Euler Fraktur from AMSfonts are (c) American
Mathematical Society (see below).
Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
is a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license (“Fonts”) and associated
documentation
files (the “Font Software”), to reproduce and distribute the Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute,
and/or sell copies of the Font Software, and to permit persons to whom
the Font Software is furnished to do so, subject to the following
conditions:

The above copyright and trademark notices and this permission notice
shall be
included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional
glyphs or characters may be added to the Fonts, only if the fonts are
renamed
to names not containing either the words “Bitstream” or the word “Vera”.

This License becomes null and void to the extent applicable to Fonts or
Font Software
that has been modified and is distributed under the “Bitstream Vera”
names.

The Font Software may be sold as part of a larger software package but
no copy
of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
INABILITY TO USE
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of GNOME, the GNOME
Foundation,
and Bitstream Inc., shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Font Software without prior written
authorization from the GNOME Foundation or Bitstream Inc., respectively.
For further information, contact: fonts at gnome dot org.

AMSFonts (v. 2.2) copyright

The PostScript Type 1 implementation of the AMSFonts produced by and
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
available for general use. This has been accomplished through the
cooperation
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
Members of this consortium include:

Elsevier Science IBM Corporation Society for Industrial and Applied
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)

In order to assure the authenticity of these fonts, copyright will be
held by
the American Mathematical Society. This is not meant to restrict in any way
the legitimate use of the fonts, such as (but not limited to) electronic
distribution of documents containing these fonts, inclusion of these fonts
into other public domain or commercial font collections or computer
applications, use of the outline data to create derivative fonts and/or
faces, etc. However, the AMS does require that the AMS copyright notice be
removed from any derivative versions of the fonts which have been altered in
any way. In addition, to ensure the fidelity of TeX documents using Computer
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
has requested that any alterations which yield different font metrics be
given a different name.

$Id$
Loading

0 comments on commit 9ea5f63

Please sign in to comment.