Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Static font name for loading fonts #29515

Closed
4 tasks
m2-assistant bot opened this issue Aug 13, 2020 · 1 comment · Fixed by #29210
Closed
4 tasks

[Issue] Static font name for loading fonts #29515

m2-assistant bot opened this issue Aug 13, 2020 · 1 comment · Fixed by #29210
Assignees
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.

Comments

@m2-assistant
Copy link

m2-assistant bot commented Aug 13, 2020

This issue is automatically created based on existing pull request: #29210: Static font name for loading fonts


Description (*)

The variable @font-family-name__base shouldn't be used when loading the Open Sans font because it's not really something that should change, since the source will still point to the Open Sans font. Using the variable here (can) cause issues when you change the base font (e.g. in a child theme).

Example 1:

If your custom theme extends from the Blank Theme and you change the base font with:

@font-family-name__base: 'Trenda';

This will be the compiled CSS:

Screenshot 2020-07-20 at 10 24 57

Which is already wrong, but doesn't directly lead to problems since 'Trenda' is a custom font and you'll probably do something like this in your theme:

.lib-font-face(
    @family-name: 'Trenda',
    @font-path: '@{baseDir}fonts/trenda/Trenda-Regular',
    @font-weight: @font-weight__regular,
    @font-style: normal,
    @font-display: swap
);

In which case this @font-face block will be included in the compiled CSS later, and your browser will only 'use' this one. However, if you only load the font in regular font-weight here, and you want to show text in bold, the browser will show that text in Open Sans (bold).

Example 2:

If your custom theme extends from the Blank Theme and you want to switch to a 'websafe' font, for example Times New Roman:

@font-family-name__base: 'Times New Roman';

Text won't be displayed in the real Times New Roman but in Open Sans because that is loaded under the name 'Times New Roman'.

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Change @font-family-name__base to 'Times New Roman' (either temporary in Blank Theme or in a theme that extends from Blank)
  2. Text should be shown in 'Times New Roman' (serif), not in Open Sans (sans-serif).
  3. Check the compiled CSS and see if the open sans is properly loaded (name and src of @font-face block should still be of Open Sans)

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)
@m2-assistant m2-assistant bot added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Aug 13, 2020
@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Aug 13, 2020
@ghost ghost assigned woutk88 Aug 13, 2020
@ghost ghost added this to Ready for QA in Community Backlog Aug 13, 2020
@ghost ghost moved this from Ready for QA to PR In Progress in Community Backlog Aug 13, 2020
@sidolov sidolov added the Priority: P3 May be fixed according to the position in the backlog. label Aug 13, 2020
@magento-engcom-team
Copy link
Contributor

Hi @m2-assistant[bot]. Thank you for your report.
The issue has been fixed in #29210 by @woutk88 in 2.4-develop branch
Related commit(s):

The fix will be available with the upcoming 2.4.2 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label Aug 27, 2020
@ghost ghost moved this from PR In Progress to Done (last 30 days) in Community Backlog Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Priority: P3 May be fixed according to the position in the backlog. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
No open projects
Community Backlog
  
Done (last 30 days)
Development

Successfully merging a pull request may close this issue.

3 participants