Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

[WiP] Google Fonts - Generalise option name, clean-up fonts folder and simplify UX#50

Closed
richard67 wants to merge 6 commits intojoomla:developmentfrom
richard67:generalise-and-clean-up-google-fonts
Closed

[WiP] Google Fonts - Generalise option name, clean-up fonts folder and simplify UX#50
richard67 wants to merge 6 commits intojoomla:developmentfrom
richard67:generalise-and-clean-up-google-fonts

Conversation

@richard67
Copy link
Member

@richard67 richard67 commented Aug 30, 2020

Pull Request for Issue #32 .

Summary of Changes

  • Move the woff and woff2 files to sub-folders, but not the (s)css files, so several (s)css files can share fonts of one or more su-folders.
  • More general name of the option, i.e. not use "Google", because fonts could be downloaded and used from any provider, as long as woff and woff2 files are available, and the css could use either one font or a combination of fonts for diverse heading levels and body text.
  • Simplify UX: Only one list field for controlling the use of extra fonts, i.e. no need to first click on "Yes" and then select the font, it can be done in one step with a font, and select "None" to switch it off again.
  • Remove the description from the remaining field.
  • Use a list field and not a filelist field in order to be able to set nice names for the fonts or font combinations. The names don't need to be translated as far as I can see up to now.

Testing Instructions

  1. Checkout the development branch in your Cassipeia local git clone and if necessary pull the latest changes.

  2. If never done before:

  • Run composer install and npm ci.
  • Install Blog Sample data.

Alternatively to steps 1 and 2 you can make a new installation, using the installation package from the testing PR #48 , https://test5.richard-fath.de/Joomla_4.0.0-beta4-dev-Cassiopeia-Test-Full_Package_2020-08-30_v2.zip , and installing blog sample data.

  1. Check content of the media/fonts folder.
    Result: See 1st screenshot in section "Actual result" below.

  2. In backend, check the "Advanced" options of the Cassiopeia template style.
    Result: See 2nd screenshot in section "Actual result" below.

  3. Apply the changes of this PR.

  4. Run npm ci.

Alternatively to steps 5 and 6, you can update the installation using the "Upload & Update" tab of the "Joomla Upda" component and using using the installation package from the testing PR #48 : https://test5.richard-fath.de/Joomla_4.0.0-beta4-dev-Cassiopeia-Test-Update_Package_2020-08-30_v2.zip.

  1. Check content of the media/fonts folder.
    Result: See 1st screenshot in section "Expected result" below.

  2. In backend, check the "Advanced" options of the Cassiopeia template style.
    Result: See 2nd screenshot in section "Expected result" below.

  3. Toggle the "Extra font(s) ..." dropdown, save settings and check the result in frontend visually and using your browser's inspection tool.
    Result: The font selection is applied as well as without this PR.

Expected result

  • The media/fonts folder:
    j4-cassiopeia-pr-50_2

  • Cassiopeia's template style options:
    j4-cassiopeia-pr-50_1

Actual result

  • The media/fonts folder:
    j4-cassiopeia-pr-50_4

  • Cassiopeia's template style options:
    j4-cassiopeia-pr-50_3

Documentation Changes Required

None beside what has to be done for the new option anyway.

- More general name of the option, i.e. not use "Google".
- Simplify UX: Only one field for controlling the use of extra fonts.
- Remove the description.
- Use a list field and not a filelist in order to be able to set nice font names.
@richard67 richard67 changed the title [WiP] Google Fonts - Generalise option name, clean-up fonts folder and simplify UX Google Fonts - Generalise option name, clean-up fonts folder and simplify UX Aug 30, 2020
@richard67 richard67 marked this pull request as ready for review August 30, 2020 16:32
TPL_CASSIOPEIA_FONT_NAME_LABEL="Google Font Name"
TPL_CASSIOPEIA_FONT_NAME_DESC="Example: only one font Josefin Sans or a font combination Montserrat + Work Sans."

TPL_CASSIOPEIA_FONT_LABEL="Extra font(s) for text and headings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What else could a font be for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianteeman

Ok, I'll remove the " for text and headings".

Is the "Extra font(s)" ok? Or should it be somethine else, e.g. "Load font(s)" or "Add font(s)"? And is the "(s)" ok for showing it could be a font or a combination of fonts, depending on the particular (s)css file?

Copy link
Contributor

@brianteeman brianteeman Aug 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To match the style guide it should be capital F

It is not very accessible to a screen reader to have (s)

Is it a multiple select?

Needs to be clear that this will be for fonts that are not part of a users system. ie they will be downloaded over the internet by every user. Personally I would never use this as it will effect the performance of the site

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brianteeman Capitalisation "Font(s)" already fixed.

It is a single select, but it selects a css file. This can use one font for all, or a conbination of fonts, e.g. font x for h1, h2 ... h6 and font y for body, or however you define it there.

Correct but maybe too long would be "Extra Font or Font Combination". Shall I use that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And should we translate the font or font combination names, too? In most languages I've ever seen, e.g. Russian or Japanese, such names are (or at least can be) treated as literals with latin characters. But you have more experience in web, so maybe my experience is wrong because too limited.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you won't at least suggest a better label text or tell me "Extra Font or Font Combination" is ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not possible to suggest something because its not clear what the feature does

Extra Font means extra to what
Font combination doesn't indicate that it will be using font files that have a negative impact on my sites performance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the code and test the PR and you will see what the feaure does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see what it does - I cant see what it is intended to do

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I think that was explained before: We want to provide a possibility to use locally stored fronts for those who don't wanna load them from Google fonts for whatever reason, GDPR or whatever else.

It was requested to have that possibility, and it was on the task list for that Cassiopeia working group before I joined it.

If that makes sense or not I don't really want to decide. It was not my idea, I only wanted to help with implementation.

Because the was using a CSS file to load the fonts we can do more than just load one font, and so we can select one CSS file which uses several fonts. Currtently the examples here don't do that.

I wanted to keep this work piece separate so we could later still decide to use it or not, but development here was going the way that it was merged into the development branch.

So later it might be harder to revert that part, but it will still be possible, and I would be the last one who would fight against reverting if it was clear that the feature is not accepted by the majority or even a large part of the community.

You are right regarding performance of loading those fonts from the site. Maybe we should mention that in docs, if that fautre is accepted, or even show a kind of warning text in the template style settings.

@brianteeman
Copy link
Contributor

Having checked the Fira font it definitely can not be transliterated or translated as that would be a breach of the trademark

@brianteeman
Copy link
Contributor

I am assuming that no one has realised that neither of these fonts will work in non-latin character sets

@richard67
Copy link
Member Author

We have realized that and are looking for better ones.

@brianteeman
Copy link
Contributor

Good luck in that as to the best of my knowledge there is no google font that ships with all character sets. Which is why joomla has never shipped with one before as out of the box joomla really should work perfectly with all supported languages. It's not "all together" if some languages are excluded.

The only one that really does is the noto font and it does this by having separate fonts for each character set or having a single 20mb font file

@richard67
Copy link
Member Author

Well with the solution here, one can use different template styles for particular languages and in that template style select a CSS for a font (or font combination) which is suitable for that language and regarding design aspects looks similar to the fonts used for e.g. for English.

@brianteeman
Copy link
Contributor

Out of the box on install?

@richard67
Copy link
Member Author

If we find suitable fonts for Arabic, Greece, Hebrew, Russian, ... we could ship them with the core and give them telling names in the options so people can see they are good for e.g. Greece, and maybe we could provide a readme in the media/fonts folder where we have the fonts.

@brianteeman
Copy link
Contributor

you miss the point.
if you install joomla in arabic will you see text or little tofu squares when you visit the frontend of the site for the very first time.
If you add russian to your site will you then have to know to go and create a new template style with a new font selection

a readme in the font folder will be too late and its not available to users from inside the joomla ui

@richard67
Copy link
Member Author

I did not miss the point and it is true what you write.

But currently in J4 core the Cassipeia template uses the "Fira Sans" font anyway, without even a possibility to change that or switching it off without making an override.

@richard67
Copy link
Member Author

Maybe we should include "Noto Sans" as font and use it as default? It looks clear and is readable and covers many character systems, seems to work with Arabic and so on. I know, design is not finished yet.

Anyway, the whole discussion above was about the local fonts feature in general, not about the changes to it made by this PR.

But as long as we have no other (dummy) PR or issue where we can discuss that, I am ok with it to continue here.

@richard67
Copy link
Member Author

Update: It seems to be a bit big, the whole "Noto Sans" font package. Some 1.1. GB. Not sure if we should ship it with the core. Any opinions?

@richard67
Copy link
Member Author

I just see the 1.1 GB are for the complete "Noto" font family, which includes some 50% serif fonts and a bunch of historical writing systems like "Noto Sans Ugaritic", "Noto Sans Runic" or hieroglyphs, which we will for sure not need. So at the end we won't need many fonts, the "Noto Sans" covers already Greece and Cyrillic completely.

@brianteeman
Copy link
Contributor

image

@richard67
Copy link
Member Author

Yes, "Noto Sans" seems to be sufficient for the most languages.

@richard67 richard67 changed the title Google Fonts - Generalise option name, clean-up fonts folder and simplify UX [WiP] Google Fonts - Generalise option name, clean-up fonts folder and simplify UX Sep 4, 2020
@richard67
Copy link
Member Author

Back to draft because changes have to be made for different fonts due to the upcoming design. I'll either modify this PR or make a new one soon.

@richard67 richard67 marked this pull request as draft September 4, 2020 16:51
@richard67
Copy link
Member Author

Closing in favour of #61 .

@richard67 richard67 closed this Sep 6, 2020
@richard67 richard67 deleted the generalise-and-clean-up-google-fonts branch September 6, 2020 00:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants