Custom font not displaying languages other than English properly on Windows - css

My problem is a custom font works fine with the English language on Windows or Linux Chrome browser, but does not display other languages properly on Windows though it seems to work well on Linux.
I am using a custom font, "Source Sans Pro".
body {
font-family: 'Source Sans Pro', sans-serif;
}
Here are examples of rendering.
Linux rendering English
Linux rendering other languages ex:Tamil
Windows rendering English
Windows rendering other languages ex:Tamil
Let me know why it is happening and how to solve it.
Thanks in advance.

When debugging custom fonts, I open developer tools and do a few checks:
Check network tab, did the font file load?
Check elements, is the fallback applied instead of my custom font? In your example, using a fallback with serifs would make it much more obvious if the fallback was being applied.
If the font is being loaded and applied, is it capable of the styles I'm asking? Refined bold or light styles, Cyrillic or other languages require additional files. For example, try selecting Roboto and visit the Customize tab in the bottom drawer.
There are multiple ways to load a custom font. Seeing as Source Sans Pro is available on Google Font, here's a link to their documentation for getting started.

Related

Windows font issue and how to debug for customer

Recently had a customer send in a ticket complaining that their font has changed (within the week or so). The font on the site has not changed in probably a decade. What I suspect is that perhaps a recent windows up that times in line with the change is effecting the font he sees, or, more likely, a setting changed on his end.
the font we use
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif
It is my understanding that Helvetica Neue will likely get replaced by something else on windows since, just from googling, I find that font is not included in windows.
My question is, is there any way I can help debug this on his end to figure out exactly what is going on? It does make the site difficult to read for this user and I would like to fix it, and also know for sure what I am talking about. I usually try very hard not to just reply with, "looks good on my machine". Inspecting it shows the same font family as what I posted above.
None of the font options in that css appear to be what is showing.
The one distinguishing trait I can see in the font is the letters de overlap or touch.
This is for web content, the browsers mentioned where most recent Chrome, which I also tested on (verified exact same version numbers) and did not have the issue, and Edge which I do not have.
If you can't access their computer, it's going to be hard to pinpoint the exact cause. Windows font substitution is the normal culprit in this situation:
As stated here:
https://office-watch.com/2021/windows-substituting-arial-font-for-helvetica/
"Windows is setup to use Arial whenever it sees a reference to ‘Helvetica’. This happens at the Windows level and doesn’t just apply to Microsoft Office. Most web browsers get the same thing – web pages that ask for ‘Helvetica’ to display in web page will get the Arial font instead. It drives web designers crazy, especially since CSS has a way to choose from a family of preferred fonts.
Way down in the bowels of the Windows Registry is HCLM\SOFTWARE\Microsoft\Windows\NTCurrentVersion\FontSubstitutes which lists the substitutions."
Additionally, if you run a comparison of arial vs helvetica neue...using the word video you mentioned, you get this:
Notice the difference in kerning (separation between letters/characters) between characters 'd' and 'e'. Arial appears 'clumped' when compared to Helvetica Neue.
I have no reputable source to provide, but this exact situation has happened to me before. It was caused by me installing a faulty font of a similar name.
It was hell to read most websites and I had to get a chrome extension to change everything to Arial to be readable. Ask them if they're having this problem on other websites as well then tell them to delete the "Helvetica Neue" font file on their computer (Mine was named Helvatica Neue56878 if it helps). This solved the problem for me.
How to debug: Check whether the specific computer have the Helvetica font installed. You can do this by going to the Fonts settings of windows. To open Font Settings just open windows search and type Font:
Font Settings will show you Available Fonts that are installed in your computer. Type Helvetica in the search bar and see if Helvetica font is installed:
If it's not, you can go and download and install the font on that computer and the problem would be solved.
CSS solution: To avoid this problem from happening in the future, you can include the font's .ttf file in your project and use #font-face to set it as a font on your project.
#font-face {
font-family: "digital-7";
font-style: normal;
src: url("~/assets/fonts/digital-7.ttf");
}
You can use it like so:
.container{
font-family: "digital-7";
font-size: 4em;
color: black;
}

Can someone explain why using web safe fonts in CSS doesn't seem to work for me?

I know this is an extremely basic and stupid question, but I seem to be having a genuinely curious problem.
When using what are supposed to be web-safe fonts like Didot, and using
header h1{
font-family: Didot, serif;
font-size: 36px;
}
my browser just displays the standard serif font.
In fact I can't seem to get it to display any web safe font, it will only display either the standard serif or sans-serif font. I know my selector is correct because I CAN change between serif and sans-serif, but I know its not displaying other web-safe fonts because I tried both Arial and Helvetica (which are both definitely web safe) and when I refreshed from one to another there was absolutely no difference in the font displayed.
I'm a complete beginner and I'm using the simplest possible beginner environment, just an html page linking to a css file which I'm opening with my browser (the url shows up as file:///C:/Users/Agent%201/Desktop/Web%20Projects/ResumeSite/index.html if that is at all relevant). I've tried opening it with both chrome and edge, same results on both
Is there something wrong with my css? Or are there limitations when just opening a local html file with my browser?
Sorry if I'm this is a really dumb question, but I really can't find an answer as to why my fonts aren't working, I've tried !important and some other weird solution I found which involves changing the selector to "header h1, header h1 *" and that did nothing.
Thank-you for any help you can provide me!
When using what are supposed to be web-safe fonts like Didot, and using...
Didot is not a "web-safe" font.
Didot is included with macOS, which may lead some web-designers to assume that it's also available on other platforms (like Windows, Linux and Android) or that those platforms have automatically-mapped equivalents (like how many browsers will map Helvetica to Arial), however that is not guaranteed.
Also, just because a typeface is included with an OS does not mean it is licensed to you to use commercially or in a website - you can be sued for publishing an OS-licensed font onto the public web without having your own font-license.
A "web-safe" font is a typeface that is broadly installed and supported by most contemporary browsers without the need for additional downloads or font installations.
Many typefaces are broadly installed, such as Microsoft's Core fonts for the web which are preinstalled on all Windows computers - and many other operating systems such as macOS either come with the same fonts or have very similar equivalents (e.g. Helvetica instead of Arial) which are automatically mapped by the browser.
The only way to determine if a font is "web-safe" is by doing your own leg-work and manually checking to see if all-or-most of your target users' devices have that typeface available. You can check font availability on Wikipedia and other sites:
macOS: https://en.wikipedia.org/wiki/List_of_typefaces_included_with_macOS
Windows: https://en.wikipedia.org/wiki/List_of_typefaces_included_with_Microsoft_Windows
iOS: http://iosfonts.com/
Android: Consult Android's fonts.xml for the minimum set of stock fonts and default fallback mappings (e.g. "Helvetica" goes to "sans-serif").
You might notice that Android's font list is very... short. That's because the base Android OS isn't what ships on most peoples' phones: Google's layer on top of Android, and OEMs (like Samsung, etc) will add their own fonts on top, but I don't know where to get that list from at-present, sorry.
A "web-safe font stack" means that at least one of the fonts listed in a font-family property value can be safely assumed to be available for use, not that all of them are - nor that the first-preferred-font will be available.
And any font-family list can be made "safe" by adding a CSS fallback generic-family name to the end (i.e. specifying the least-preferred font). Those names are specified in the CSS Fonts Module and are:
serif
sans-serif
cursive
fantasy
monospace
In your case, the property font: Didot, serif is "web-safe" because it has the serif generic-family name at the end. Your visitors will only see the Didot font being used if they already have it installed on their computer, phone, tablet, etc.
If you do want to use Didot, then you need to publish it as a WOFF file and add it to your stylesheet with a #font-face rule: https://css-tricks.com/snippets/css/using-font-face/

Font styling in a .vtt file?

I am creating a video about programming and I want to include subtitles having a .vtt extension. I think it is better if the coding and technical texts in the subtitles are displayed using the Consolas font. Like in this example:
Open Terminal and write sudo apt-get update
In the above example, the technical part is in Consolas font. So is this possible in a .vtt file?
Be aware that the '::cue' css-styling, as mentioned
in the answer below, became deprecated
in Video-js, beginning with version 6.x
[For details, see:] https://github.com/videojs/video.js/issues/4852
In my experience with VTT-styling with Video-js, there
are also issues in some browsers, even if/when you remain
back and use version 5.x of Video-js (which is what
I've been doing). One such example is that in Firefox browser, the font color comes out WHITE, no matter what you specify. (Chrome will honor whatever font color you specify.)
WebVTT supports a style block:
STYLE
::cue {
font-family: Consolas, sans-serif;
}
If Consolas is not installed on the users computer, you should be able to use a web font.
Source:
https://css-tricks.com/improving-video-accessibility-with-webvtt/

Font not being recognized in web app

I have created a website based on Grails web framework that uses Groovy.
For some reason I'm not able to get the fonts to load properly.
I'm using: font-family: "Avenir Next Ultra Light","Avenir Next";
On my Mac, the font loads perfectly using Safari and Chrome but not on Firefox. On other systems I've noticed that the font doesn't load at all.
I understand that it's a paid font but just not sure what to do to get the font incorporated into the site properly.
Any advice would be appreciated!
Store the font file somewhere on the server.
#font-face {
font-family: NAME;
src: url('/FILEPATH/FILENAME.ttf');
}
p {
font-family: NAME;
}
Browser Support: http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
EDIT: And, as Alex K. said, make sure you have a license if it's a commercial font.
Can't speak for FireFox but a more important fact is that the font must exist in an appropriate format on all machines viewing the page. If the font does not exist as an installed font it must be embedded in the page, something you need a license for if its a commercial font.
I would suggest browsing for something similar and using the boilerplate from https://www.google.com/fonts.

Web page Fonts change after locale has changed IE8

In my webpage, it is Ok for presentation in Language English US. But our web application supports Locale.
When I use browser language English US, the web page can be viewed according to my css even I change default browser font.
But when I change to browser language Japanese(JP), the web page uses default browser font, not use my font in css.
Why is it occurred?? I wanna know how to modify it.
PS:
I use IE8 where problem occurs, but in firefox 15.0.1 and chrome version 22.0, the problem does not occur.
According to my understanding,
CSS font property said
The font-size and font-family values are required. If one of the other
values are missing, the default values will be inserted, if any.
When I use English locale(change browser language to English), one of these fonts[arial,helvetica,clean,sans-serif] are available.
So my web page works fine.
But when I change to Japanese locale(change browser language to Japanese), none of these fonts used in my css are available. So browser default browser font is used. Whenever I change browser default font, my web page presentation is also changed.
Correction is to add a japanese font MS PGothic to my css. like
font-family: MS PGothic, Arial, sans-serif;
OR
html *
{
font-family: MS PGothic !important;
}
So when browser language is japanese, MS PGothic is used. You can read CSS !important in
http://www.electrictoolbox.com/using-important-css/
This is my understanding and correction to my problem. Let me know if a better way exists.

Resources