I am curretly creating a simple website. In the contact information section, I am adding this html entry ☎ for phone (right before the phone number), and this html entry ✉ for email address (right before the email address). The idea is to display those two characters as solid black characters (or any color for that matter if I choose to change the font color in CSS).
Anyway, what I ended up with is the emoji character represented by those two codes. I do not want this. I do not want the emoji representation to be displayed. I would like to see html representation as shown in the following two links:
http://www.fileformat.info/info/unicode/char/260e/index.htm
http://www.fileformat.info/info/unicode/char/2709/index.htm
(in the two links above, notice the 'phone' and the 'envolope' at the top of the page, this is what I want).
The font I am using is 'Lucida Console', and it is part of developing a theme in WordPress.
How can I do this?
Update
This seems to be a problem with WordPress. My html is part of a WordPress theme. When I try the solution with standalone web-pages, it works. However, when I try it within a theme set of files, only emoji is displayed.
So the question now becomes, how do I ensure this works in WordPress properly?
Update 2
It is suggested that this is question is a duplicate of Inconsistent Unicode Emoji Glyphs/Symbols
This is not a duplicate question. Just because they both deal with emoji, does not make them both duplicates. My question deals with emoji showing up in a web page when using a WordPress theme, the other question deals with inconsisten emoji characters in mobile devices.
You should include a webfont with support for the characters you want to use.
To include an icon font in your CSS, use the following code :
#font-face {
font-family: 'myfont';
src:url('fonts/myfont.eot?-td2xif');
src:url('fonts/myfont.eot?#iefix-td2xif') format('embedded-opentype'),
url('fonts/myfont.woff?-td2xif') format('woff'),
url('fonts/myfont.ttf?-td2xif') format('truetype'),
url('fonts/myfont.svg?-td2xif#myfont') format('svg');
// Different URLs are required for optimal browser support
// Make sure to :
// 1) replace the URLs with your font's URLs
// 2) replace `#myfont` with the name of your font
font-weight: normal; // To avoid the font inherits boldness
font-style: normal; // To avoid font inherits obliqueness or italic
}
.emoji {
font-family: 'myfont', Verdana, Arial, sans-serif; // Use regular fonts as fallback
speak: none; // To avoid screen readers trying to read the content
font-style: normal; // To avoid font inherits obliqueness or italic
font-weight: normal; // To avoid the font inherits boldness
font-variant: normal; // To avoid the font inherits small-caps
text-transform: none; // To avoid the font inherits capitalization/uppercase/lowercase
line-height: 1; // To avoid the font inherits an undesired line-height
-webkit-font-smoothing: antialiased; // For improved readability on Webkit
-moz-osx-font-smoothing: grayscale; // For improved readability on OSX + Mozilla
}
You can then include your symbol like this:
<span class="icon">☎</span>
<span class="icon">✉</span>
If you don't know a webfont that supports your character, you can easily create one yourself using the Icomoon App. See also my open source Emoji icon font for an example of an Icon font with support for Emoji characters, which I created with the Icomoon App.
More info:
Create webfont with Unicode Supplementary Multilingual Plane
symbols
If I'm not wrong this is what you want
#phone{
font-family:Lucida Console;
font-size:32px;
color:red;
}
#email{
font-family:Lucida Console;
color:#e3e3e3;
font-size:30px;
}
<div id="phone">PHONE ☎</div>
<div id="email">EMAIL ✉</div>
To force the font renderer to use the non-emoji version, you can try using a Variation Selector.
<div>PHONE EMOJI ☎️</div>
<div>EMAIL EMOJI ✉️</div>
<div>PHONE TEXT ☎︎</div>
<div>EMAIL TEXT ✉︎</div>
See more: http://unicode.org/Public/8.0.0/ucd/StandardizedVariants.html
Related
Here is the problem. So everything works fine for me on my machine, localhost and when the website is uploaded to online host. But I got my friends to go to the site to check if everything is working and the regular Roboto font loads fine but the thin version of it doesn't. I originally just had the import link from google for the font but later added the font face import code that I found on here but that doesn't work too. I even tried adding the font-weight property but it still doesn't work.
I need help my head hurts real bad here's the code enjoy
Top of the css file
#import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
#font-face {
font-family: 'Roboto';
src: local('Roboto'), url(fonts/Roboto-Regular.ttf) format('ttf');
}
#font-face {
font-family: 'Roboto thin';
src: local('Roboto thin'), url(fonts/Roboto-Thin.ttf) format('ttf');
}
Class for one of the texts that uses the font
.txt2 { /* text */
font-family: 'Roboto thin';
font-size: 24px;
color: white;
text-align: center;
margin-top: 1%;
margin-bottom: 5%;
margin-left: 20%;
margin-right: 20%;
font-weight: 100;
}
The #font-face is loading a local file, but also, import in my experience doesn't work like how you expect. I'm on mobile so I can't get too detailed but I usually call the fonts url in the html using a tag in the head. This has the added benefit of the browser being able to pull that file in asynchronously, rather than after the css file loads, which will give you a small speed increase.
More than likely this code is actually failing for you too, but your browser has the font in cache and it's safe to use so it does. Or you have robot installed outright.
EDIT: Alright, I'm on a desktop now, and want to clarify some things.
#font-face defines a font and how it can be called. It gives it a name, where the font files are stored, and if it's considered italicized, normal, etc.
The Google Fonts file you are calling contains that information, it's whole purpose is to define the things you are putting in your #font-face lines.
As I said, #import is a bit tricky.
First and foremost, make sure your #import statement is the very first thing your CSS file contains. If you only have one #import, it should be the first line.
Using Google Fonts' other option, the HTML , will work marginally faster. The difference may stop your users from seeing a flicker of the wrong font on their first page load.
Remove the #font-face rules you have altogether, they are overwriting your imports.
As a best practice, give your font-family rule a fallback. font-family: 'Roboto thin', arial, sans-serif;
This font Glamora is displayed with more thick than it should be and other weird things
the font look like this,
but is displayed like this
this is the formatting for that text
.brand h1{
color: #FEF2DB;
font-family: Glamora;
font-size: 230px;
line-height: 68.1%;
text-align: center;
letter-spacing: 0.095em;
}
There’s probably only one weight of this font, ie. a single style with no bold version or other variants.
By default, h1 and all other headings are set to be bold, so you are probably getting some faux bolding, created by the browser.
Try adding:
.brand h1 {
font-family: Glamora;
/* Etc. */
font-weight: normal;
}
I was able to reproduce your issue, and adding font-weight: normal; fixed it:
This might also have something to do with how the font outlines or how the font file was built, or the fact that it hasn’t been produced as a web font.
The license doesn’t appear to allow converting it into a web font, but it might be worth getting in touch with the designer and seeing if they would produce WOFF and WOFF2 files for you, or modify the license to allow converting the format. That said, that might not impact the issue, and this CSS change does fix it.
Using the normal CSS font-face does not appear to work properly on the new Windows 10 Edge browser. Works fine on IE11 and all other browsers. Has anyone else seen this? Seems like a bug in the browser.
Here’s the CSS we’ve been using.
#font-face {
font-family: "Univers";
src: url("../fonts/univers-webfont.eot");
src: local(Univers), url("../fonts/univers-webfont.eot"), url("../fonts/univers-webfont.svg"), url("../fonts/univers-webfont.ttf"), url("../fonts/univers-webfont.woff");
font-weight: normal;
font-style: normal;
}
.button_black {
font-family: "Univers";
font-size: 18px;
color: #slb-off-black-1;
}
Short Answer
Put quotes around the font name when using the local("Font Name") syntax.
Explanation
"Univers" renders fine in both Edge and Firefox. Your "Please log in..." element, though, is targeting "Univers Condensed", which renders in Edge only if you use local("Univers Condensed") with quotes. That is probably because Edge is more strict that Firefox is. MDN says...
src URL for the remote font file location, or the name of a font on the user's computer in the form local("Font Name"). You can specify a font on the user's local computer by name using the local() syntax. If that font isn't found, other sources will be tried until one is found.
Some Snips
Here are some screen shots that show the problematic CSS and HTML on your site.
Univers Condensed
No Quotes on local()
I have been using Font-Awesome and its icons for a while now, and it has been working just fine.
Today, however, it only displays blank squares instead of icons. I have read many other related questions, but none of those cases apply to me. As I said, it worked before, and I did not make any changes to the Font-Awesome files (I am using a downloaded version of FA, not the CDN) or to the HTML templates that display the icons.
So I want to start debugging the process. One example is this:
<i style="color: orange" class="fa fa-exclamation-triangle"></i>
However, I cannot find any urls in the CSS of the affected elements, when inspecting with Chrome. What I do see on every icon element though, is something like this:
.fa-warning:before, .fa-exclamation-triangle:before {
content: "\f071";
}
Where \f071 is the "blank square" character.
So my question is:
Where do the icons come from, and how can I debug no-show FA icons, in general?
UPDATE
I found out that \f071 and its friends are actually symbols referring to icons, stored in the font files. The fact that they show up as blank squares seems to indicate that the font has not been loaded successfully.
However, I checked and the client downloads fonts/fontawesome-webfont.woff and fonts/fontawesome-webfont.ttf just fine.
Also, the elements' font is correctly set through the fa class:
font-family: normal normal normal 14px/1 FontAwesome
What else is necessary to make sure, a font has loaded successfully?
UPDATE
I solved it: Font file(s) were corrupted/not delivered properly. That's always something to check out first!
FontAwesome is... a font!
This means you'll have a set of characters, which are (visually) icons. These characters are generally contained between \e000 and \f8ff (which are private use area's characters).
When you see this code:
.fa-warning:before, .fa-exclamation-triangle:before {
content: "\f071";
}
It means the \f071 character will be displayed in the pseudo-element. It's coupled with this code, which loads FontAwesome font for .fa elements:
#font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.2.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.2.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.2.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
Seeing a white square can means:
your font is not loaded (most common problem)
your font is not well created (re-download it)
your CSS is missing the font declaration (#font-face {})
your CSS is missing the font call (font: normal normal normal 14px/1 FontAwesome;)
How to debug:
Check that you're using the right class name (.fa .fa-foo)
Check that your FontAwesome CSS is loaded (it should be the case as you're seeing the square)
Double-check that your font is loaded. There could have a path issue, like font/ folder instead of fonts/
Have a look on your .htaccess. People often makes strong rules which affect assets.
If everything is ok, try to re-download the font (font files could have been corrupted)
Introducing new font in CSS with #font-face as
#font-face{
font-family:'myCustom';
font-style:normal;
font-weight:400;
src:local('myCustom'),
local('myCustom-Regular'),
url('myCustom.woff') format('woff')
}
and defining the font as
font-family: myCustom, Tahoma, Verdana, cursive;
However, I have two problems:
Until download my custom font, it will not show the second (alternative font), and the text will be blank.
If for any reason the visitor browser does not download my custom font, it will not display any text.
How can I display the alternative font until availability of my custom font?
What I expect to happen is that the first available installed font, among those listed in the font-family list, will be used. If this does not happen, please post a URL for inspection.
But you may wish to consider the list of font families you use. The odds are that if Tahoma and Verdana would be acceptable, cursive would not be; a normal generic fallback font in this case would be sans-serif.