is there any open web font that fully supports small-caps?
For example if I set Roboto to small-caps, the result will look like this:
You see that the uppercased letters R and A have a higher weight than the surrounding lowercased letters. This font does not support small-caps properly.
Give a call to the foundry, every font is designed differently, if they don't have the glyphs you wont be able to have that, when I purchased the license for the webfont for the company that I work, I called the foundry I was budgeting they helped me to choose the perfect font that had the Small caps with it.
Yes, this is possible. Try using the font-variant and font-variant-caps css rules. Take a look at the MDN Docs on these properties for more info, here and here.
small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps
Specifies the keywords and functions related to the font-variant-caps longhand property.
small-caps
This keyword forces the use of small capitals letters for lower case characters. It corresponds to the OpenType value smcp; if the font doesn't support them, it synthesizes the glyphs.
.my_style {
font-variant: small-caps;
}
<p>Hello</p>
<p class="my_style">hello</p>
Related
in my web project I need to mix latin and cyrillic characters. Unfortunately the cyrillic characters are not part of the webfont, thus the fallback steps in.
As I use a bold webfont the latin characters are bold but the fallback would only be bold, if I set the whole paragraph as font-weight:bold or alike.
I remember discussions that this should be prevented as some browsers can't display them correctly, but during my tests I wasn't able to produce a really broken layout when bolding the webfonts.
What do you think? How can I solve this problem?
Thank you
Markus
Yes, most webfonts provide specific weights like 400 for Regular and 700 for bold. If these aren't provided and you bold/strong them, you are in essence using the font outside of its original intent.
Font weight values can be used, but I'd always stick with the ones provided with the webfont you're using.
Also, if a weight you declare is not available, it will not show on the page but simply default the "logically closest" (this from the CSS Tricks article below) weight.
See a little more basic description here: https://css-tricks.com/almanac/properties/f/font-weight/
Yes it's still recommended you don't do this.
By using font-weight:bold you're forcing the browser to try and create the bold version of this font itself, which can often look distorted / fuzzy. This is referred to as faux styling.
You should set different #font-face definitions with different font-weight values which make use of multiple font files.
I've never become fluent with CSS but I don't think I had this situation before.
I'm thinking of using stylish to add CSS to a third-party site over which I have no direct control. So the HTML and CSS is not really set up for the kind of customizations I want to do.
The site I wish to tweak doesn't allow good control over fonts but some of its pages (user created) make a lot of use of some exotic Unicode ranges (eg. Khmer) that my OS/browser combination choose a terrible font for:
Can I make a CSS rule that will apply to all text in a page that falls within a certain Unicode range to set it to a known good font, without delving into the structure of the page HTML/DOM?
(Or is unicode-range only for doing something different with webfonts?
The answer is yes in most browsers
MDN - Unicode Range
The unicode-range CSS descriptor sets the specific range of characters
to be downloaded from a font defined by #font-face and made available
for use on the current page.
Example:
#font-face {
font-family: 'Ampersand';
src: local('Times New Roman');
unicode-range: U+26;
}
Support: CanIUse.com
Also see this Article
unicode-range(s) can be used to specify which specific set (or range) of characters you want to be downloaded from a font in an attempt to save bandwidth. See here: Mozilla unicode-range info
Without seeing the actual CSS you could attempt to just force a different font to be used completely by doing something such as declaring
body{font-family: arial,sans-serif;}
or adding !important (which I would avoid under any normal circumstance) if the other fonts refuse to give way e.g.
body{font-family: arial,sans-serif !important;}
If you can bypass using the original font faces then the unicode-ranges will cease to be important. Watch out for things like icon-fonts though as removing those may make certain symbols/graphics disappear.
Hope that helps.
Sorry I rather misunderstood your question - thought you wanted rid of the existing unicode fonts altogether.
I'm using the "Quicksand" font for a web project (http://www.google.com/fonts/specimen/Quicksand) and I've a problem : the ² character doesn't exist for that font. I thought that it would be rendered in other fonts (written after Quicksand in the font-family property), but it is not. When I write ², the only thing rendered is a white space.
Is there a way to render not supported characters by other fonts ?
Here's the CSS used :
font-family: "Quicksand", Helvetica, Arial, sans-serif;
There is a bug in the Quicksand font: for the Unicode code position U+00B2, SUPERSCRIPT TWO, it has an empty glyph. It is 396 units wide, so it is wider than a normal SPACE (300 units) in the font. Another character with a similar problem is U+201A SINGLE LOW-9 QUOTATION MARK “‚”, which has an empty glyph 230 units wide.
In principle, you could circumvent the bug by using unicode-range in a #font-face rule to specify that a particular character be taken from a different font. However, browser support is still too limited (and the approach would require that you host the font files instead of using them from the Google server).
Another possibility would be to edit the font. This requires a font editor and a permission from the copyright holder (and your hosting the font files of course).
A third option is to wrap each occurrence of “²” in a span element with a class and setting font-family on them suitably. Beware that this means mixing glyphs from different fonts, which should be avoided in good typography.
Finally, consider using a different font. There are several questions about rendering problems with the Quicksand font at SO.
I'm searching for a method to tell the browser to render each glyph rendered with a specific font, e.g. FreeMono, in a bigger font size than glyphs rendered with other fonts. The reason for that is, that I use characters like ᚠ in a website and these glyphs are rendered using FreeMono in Chrome (see inspect element → computed → rendered fonts) and they look always like they're to small to fit the surrounding text. Is there any way I can do that?
You cannot. CSS has no tools for such font-specific tuning, apart from the font-size-adjust property, which has very limited effect, limited browser support, and buggy support.
If you use a character such as “ᚠ” U+16A0 RUNIC LETTER FEHU FEOH FE F on a web page, then it will be up to each browser in each system which font (if any) is used to render it, at least if you do not explicitly suggest some font(s) that contain it. It may be FreeMono, but most computers in the world do not have it. Besides, in FreeMono, “ᚠ” is rather large—taller than uppercase Latin letters. So if it looks too small, the reason might be a mix of fonts.
To make, say, Runic letters match the style of other text, you should try and find a font that is suitable for both—so that you can use a single font, designer by a typographer to make things fit. You would then probably need to find a suitable free font and use it as a downloadable font (with #font-face). It might be FreeSerif or FreeSans; only in very peculiar circumstances would I consider FreeMono, a monospace font, suitable for rendering computer code in some cases and mostly unsuitable for everything else.
According to sitepoint (a source I typically highly trust) when specifying font-family names some Operating Systems/Browsers may be case-sensitive.
I've typically always used mixed-case values but I'm wondering if lower-case values will work just the same?
I don't have an overwhelming preference either way - but I'd hate for a page to render differently because I typed a lower-case "v" vs. "V" somewhere in a CSS file.
e.g. are there any known cases where 2 divs with the foo and bar classes below would actually render with a different font?
div.foo{
font-family:Verdana, Arial, Helvetica;
}
div.bar{
font-family:verdana, arial, helvetica;
}
Although the CSS syntax overview says
The following rules always hold:
All CSS style sheets are case-insensitive, except for parts that are not under the control of CSS. For example, the case-sensitivity of values of the HTML attributes "id" and "class", of font names, and of URIs lies outside the scope of this specification. Note in particular that element names are case-insensitive in HTML, but case-sensitive in XML.
The css3-fonts module section mandates case-insensitive comparison:
For other family names, the user agent attempts to find the family name among fonts defined via #font-face rules and then among available system fonts, matching names with a case-insensitive comparison.
so the CSS3 specification requires that font-names be treated case-insensitively.
This guy seems to have problems when using flex, so there seems to be some truth to this:
When using CSS in Flex to style
components, the font-family property
can be case sensitive on some
operating systems. For example, the
following CSS will not work on my
Safari browser with Flash Player 10:
.content{font-family: arial;}
but this will work:
.content{font-family: Arial;}
Source
Also take a look at this page that you can use to check this in your own browsers/os:
http://meyerweb.com/eric/css/tests/font-name-case-test.html
My guess is that this would only be a potential problem on Linux/Unix systems, where the file system is case sensitive. I'd be surprised if any Windows browser had a problem with this, since fonts are just files in the C:\Windows\Fonts directory.
You could try making a page with test text in a recognizable font like Courier New, but spell it funny like "CoUrIEr nEW", then go to http://browsershots.org/ where it will generate screenshots from tons of browsers. Be sure to make the font very large too, because the screenshots are small.
Something like this:
<html>
<head>
<style type="text/css">
#proper { font: bold 48px "Courier New",Courier; }
#improper { font: bold 48px "CoUrIEr nEW",CoUrIEr; }
</style>
</head>
<body>
<p id="proper">Test1 - proper caps</p>
<p id="improper">Test2 - improper caps</p>
</body>
</html>
If only one line shows up in Courier, then that browser is case sensitive.
Edit: I tested the HTML I posted above in browsershots. I didn't find any browser that didn't work. Dillo 2.1.1 for Ubuntu Linux didn't like either line (maybe that system lacked both Courier New and Courier?), all others showed both lines in Courier or Courier New. There are still mobile browsers that were not tested, though, so you should strive to use proper capitalization just in case.
A nice question indeed. I personally have not heard of any issues that have something to do with case sensitivity.
What you should worry about more is about the presence of these fonts on various systems. Verdana and Arial are not available on Mac. Helvetica is not available on Windows. You have defined two sets with zero intersection area in the Win/Mac dimensions.