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

Using the addon changes the fonts of the application #4

Closed
mlopezFC opened this issue Jun 20, 2020 · 4 comments · Fixed by #53
Closed

Using the addon changes the fonts of the application #4

mlopezFC opened this issue Jun 20, 2020 · 4 comments · Fixed by #53
Labels
bug Something isn't working

Comments

@mlopezFC
Copy link
Member

It seems that adding this addon introduces a change in font size in the application as shown in the following image:

image

@javier-godoy
Copy link
Member

Blocked by #5

@javier-godoy
Copy link
Member

Confirmed

@javier-godoy javier-godoy added the bug Something isn't working label Jul 27, 2020
@thomasdewaelheyns
Copy link

thomasdewaelheyns commented Jan 29, 2021

Is this issue being investigated? Because it is still an issue with the latest version (2.3.0). Which is a shame because it looks really useful.

I did some digging and when I include the addon to my build, the default font that is displayed is Roboto:
image
While without the addon the font is Segoe:
image

So something in the addon or its dependecies must be changing the default font type.

I investigated a bit further and it seems that the roboto font is prefered over Segoe but it is not loaded until I ad your addon. Upon adding it in the generated html it states:
<link rel="stylesheet" type="text/css" crossorigin="anonymous" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic">`
Which is not there without the addon.

When searching in my project files I find this URL only in typography.js of the vaadin-material-style node module:
document.head.appendChild($_documentContainer.content); if (!window.polymerSkipLoadingFontRoboto) { const font = 'https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic'; const link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.crossOrigin = 'anonymous'; link.href = font; document.head.appendChild(link);

So maybe something puts the polymerSkipLoadingFontRoboto to false or something else is including this url.
I hope this helps.

@paodb
Copy link
Member

paodb commented Jun 25, 2021

I did some research on this issue and I see that

<link rel="stylesheet" type="text/css" crossorigin="anonymous" href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic">

is added because paper-chip.js has an import to @polymer/paper-styles/paper-styles.js and this one has an import to typography.js. This typography.js has an import to @polymer/font-roboto/roboto.js and it's this one who adds the <link ....> part cause window.polymerSkipLoadingFontRoboto is false:

if (!window.polymerSkipLoadingFontRoboto) {
  const link = document.createElement('link');
  link.rel = 'stylesheet';
  link.type = 'text/css';
  link.crossOrigin = 'anonymous';
  link.href =
      'https://fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,300,300italic,400italic,500,500italic,700,700italic';
  document.head.appendChild(link);
}

According to this paper-styles issue one solution will be to set window.polymerSkipLoadingFontRoboto = true but I couldn't find the right place to do this within the addon so far. I'll try to come back to this issue as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

4 participants