Certain non-latin characters are displaying out of order - html

EDIT: got it by some dedicated searching. unicode-bidi: plaintext on the font's i style block does it. Very nice to be able to scope it so tightly; hopefully this won't muck with localization like a broader solution might.
Kind of hard to explain, but I'm using a webfont that leverages unicode glyphs to display its own characters.
The following code is displaying the shield between the 0 and the +
<span class="text-stat ng-star-inserted" style="">
<i class="game-icon game-icon-shield"></i>
0+
</span>
But this code displays everything in the right order (Seemingly any a-zA-Z makes it work correctly)
<span class="text-stat ng-star-inserted" style="">
<i class="game-icon game-icon-shield"></i>
a0+
</span>
Looking at the CSS provided for the webfont, I see this:
.game-icon-shield:before {
content: "ﱗ";
}
.game-icon:before {
font-family: "game-icons" !important;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-style: normal;
font-variant: normal;
font-weight: normal !important;
text-decoration: none;
text-transform: none;
line-height: inherit;
}
It seems like the character ﱗintrinsically places itself after a subsequent zero, for some reason? ﱗ0 typing that out, I placed the ﱗ before the zero but it moved itself over. ﱗa0 works fine.
I'm trying to enforce code-order for this portion of my page but I don't see a way to do that with css. direction: ltr has no effect.

Related

Mac/iOS Corrupts Custom Icon Fonts in Firefox/Chrome

I have the bug that on Mac/iOS in Chrome and Firefox browser my custom icon font is suddenly cut off.
I created the font with icomoon.io because that actually worked quite well on different browsers so far.
The font loads without errors and the size is correct.
It is also not because there is a Div/Container ... over it the icons are on top.
Fun fact: If you change the fontsize to an enormous amount like 120px the Icons are fixed again
Is this a known bug, or is there a fix for it?
Example Img
Icon Call
<i class="ke-icon-basket"></i>
Applying the class
i[class^="ke-icon"], i[class^="ke-icon"] span {
speak: never;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: KEIcons !important;
font-size: 24px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 1;
text-transform: none;
}
Font initalization
#font-face{
font-display:swap;
font-family:KEIcons;
font-style:normal;
font-weight:400;
src:url(fonts/KEIcons/KEIcons.woff) format("woff"),url(fonts/KEIcons/KEIcons.woff2) format("woff2")
}
Steps already done:
Changed to all kinds of font type
Resized icons in font
Disabled Apaches default cache function and all of the pagespeed modification which are supervised by hetzner

HTML italics and non-italics text is rendered too close to each other

There is a rendering issue with text marked as italics when no extra space is added after the italicized text and before the next text span (non-italics):
Eureka!
<span style="font-style: italic">Eureka</span>!
which makes exclamation mark being rendered too close to the last italicized character a.
Engine: Google Chrome Version 90.0.4430.85 (Official Build) (64-bit)
On the other hand MS Word inserts some extra space and mixed text looks nice:
vs
Is there a way to solve this issue?
You can use letter-spacing in your CSS. This can give you a hint how to style your document:
body {
font-size: 24px;
font-family: Arial, sans-serif;
}
.tag {
font-style: italic;
letter-spacing: 2px;
}
<span class="tag">Eureka</span>!
I can't seem to be able to reproduce your problems with Open Sans. But it seems you are using a badly kerned version. At least, I think it the kerning that determines the space between specific glyphs, but I'm unsure whether that's true for different font styles, even in the same family. But maybe Chrome decides not to kern. In that case you can ask it to kern normally, using font-kerning.
I don't think letter-spacing solves your problem, because that's about the spacing between all glyphs.
body {
font-size: 24px;
font-family: Open Sans, sans-serif;
}
.problem {
font-style: italic;
}
.hack {
margin-right: 0.1ex;
}
.kern {
font-kerning: normal;
}
<span class="problem">Eureka</span>!<br>
<span class="problem hack">Eureka</span>!<br>
<span class="problem kern">Eureka</span>!<br>

How should I use icon fonts in the TwinCAT HMI?

To replace the tedious effort of editing and saving copies of .svg files with customized colors and variants, I decided that it would be nice to try and work with modern icon libraries.
To that end, I have tried to implement Google's Material Icons library as a font, inside a TwinCAT HMI project. The result looks something like this:
Fonts/MaterialIcons-Regular.woff2 (locally hosted font file)
Fonts/Fonts.css contains:
#font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(MaterialIcons-Regular.woff2) format('woff2');
}
Themes/Base/BaseStyle.css contains the style definitions for the various classes
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px; /* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
}
/* Rules for using icons using custom colors */
.material-icons.orange600 { color: #FB8C00; }
This allows me to define a TcHmiHtmlHost, create an element, and voila!
<div id="material_icon_622" data-tchmi-type="TcHmi.Controls.System.TcHmiHtmlHost" data-tchmi-grid-row-index="2" data-tchmi-width="30" data-tchmi-height="30">
<span class="material-icons md-dark ">face</span>
</div>
However, I need to define and customize an HTML host for each time I would use a symbol this way...
What other ways have people tried to efficiently work with adding icons to their TwinCAT HMI? Is there an icon framework for TwinCAT that I am missing? Is customizing SVG files the way to go? Should I just use a modern web framework?
Thanks in advance.
We use SVG files as icons. This is flexible, and there are loads of icons available already.
The only thing that is irritating is that Beckhoff puts the SVG file in an tag as 'src'. That has the consequence that for every icon you should have it in a specific color if needed. This is the Beckhoff way (see the included images in Twincat HMI by Beckhoff). I want to use the fill property for SVG files, however that doesn't work. So I've implemented a 'hack' according to: How to transform black into any given color using only CSS filters

Font Awesome: Duotone only appearing half the time

I have a Font Awesome Pro license. Most of the icons show up, no problem, as you can see here: https://ruthannereid.com
Specifically, I use the Duotone books icon in my menu (screenshot): https://i.imgur.com/n3xoiDR.jpg
I want that same icon here (screenshot): https://i.imgur.com/8jXfyAQ.jpg
Weirdly, when I add font-family: "Font Awesome 5 Duotone" in the CSS, the icon breaks spectacularly (screenshot): https://i.imgur.com/GUK4yIq.jpg
I would love some help on this. I don't know if I need to do a PHP trick or what, but I'm willing to try any kind of code (hopefully CSS).
P. S. I've tried to add the "fa" and "fad" CSS specifications to the site::before icon manually, but it didn't fix this.
Current CSS:
.error404 .site-inner::before,
.page .site-inner::before,
.single .site-inner::before {
content: "\f5db" !important;
font-family: "Font Awesome 5 Pro" !important;
font-weight: 900 !important;
background: none !important;
-webkit-font-smoothing: antialiased;
font-style: normal;
font-variant: normal;
font-size: 80px;
color: var(--fa-primary-color,inherit);
opacity: 1;
opacity: var(--fa-primary-opacity,1);
}
When using the unicode approach rather than the class name approach there are a few gothchas and I am not sure which way you want to work. If you are using the Font Awesome 5 Pro font rather than the Font Awesome 5 Duotone font you need to make sure you specify the primary and the secondary unicodes. At the moment you are only seeing half the icon because you have only specified the primary layer of the icon.
If you take a look at the books page you will see there is a second unicode of 10f5db which I have highlighted in the screenshot below:
To also display the secondary layer you can add the following :after code alongside your original :before code
.error404 .site-inner::after,
.page .site-inner::after,
.single .site-inner::after{
content: "\10f5db" !important;
font-family: "Font Awesome 5 Pro" !important;
font-weight: 900 !important;
background: none !important;
-webkit-font-smoothing: antialiased;
font-style: normal;
font-variant: normal;
font-size: 80px;
color: var(--fa-primary-color,#fff);
opacity: 1;
opacity: var(--fa-primary-opacity,1);
}
I have not tested this solution because our Pro account does not have SO on the whitelist but am confident it should work. If it does not then please give me a shout and I will test it on one of our whitelisted domains for you.
If you are using the Font Awesome 5 Duotone font then you can specify the --fa-secondary-color as well as the --fa-primary-color.

Font display discrepancy safari 9.1.3

So I have two code elements both are styled the exact same way, both have the exact same computed styles in the safari inspector:
-webkit-box-direction: normal;
color: rgb(213, 93, 33);
display: inline;
font-family: monospace, monospace;
font-size: 14px;
font-weight: normal;
height: auto;
line-height: 21px;
text-align: center;
white-space: pre;
width: auto;
The abov css is for the span that colors the word 'setf' in both pictures.
The only difference is one is nested in a section>aside>header>nav>pre>code, and the other is nested in the same section but then main>section>pre>code:
Here are details:
Sidebar
Footer
Clearly the font weight in the second one is greater, but there is no accompanying style rule I can find anywhere (i'd provide more of the css but it is a messy mix of a normalizer and some stuff). Is there something I should look for that doesn't show up in the computed styles?
Working reference for site is here: example
The left has the thinner example and the bottom of the page has the pagination element. Any help would be greatly appreciated.
This looks to me like it might be a font smoothing problem. Does adding
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
fix it?
(note: for some reason I first thought you were seeing that difference between two browsers. If this is helpful that's great, but it now seems unlikely to me)