Outlook 2007 / 2013 not rendering CSS font-family declarations - html-email

I'm testing an email design with Litmus and for the life of me I cannot get my fonts to be properly set in Outlook 2007 / 2010 / 2013. Every single HTML / CSS trick / hack continues to render in Times New Roman:
`
I'm mostly using simple tables for layout, so all content is ultimately inside a TD element.
Here are the various techniques I've tried to set the font.
My STYLE declaration: Have tried this in both the HEAD and BODY tags & neither works.
<style>
#font-face {
font-family: proxima-nova;
src: url('assets/ProximaNova-Reg.otf');
}
#font-face {
font-family: proxima-nova-blk;
src: url('http://assets/ProximaNova-Black.otf');
}
body *, td, p, li {
font-family: font-family:proxima-nova,'Proxima Nova Regular','Proxima Nova',verdana,sans-serif;
}
</style>
CSS STYLE attribute set on TD elements:
<td style="font-family:proxima-nova,'Proxima Nova Regular','Proxima Nova',verdana,sans-serif; color:#FFFFFF; font-weight:300;font-size:18px;">
FONT tag with both FACE and STYLE attributes set:
<font face="proxima-nova,Proxima Nova Regular,Proxima Nova,verdana,sans-serif"
style="font-size:28px;
font-family:proxima-nova,'Proxima Nova Regular','Proxima Nova',verdana,sans-serif;">
Inline CSS STYLE attributes on all inner text elements (P, LI, A):
I am COMPLETELY baffled. On all other relevant clients everything is working as well as can be expected (i.e. fonts are rendering as I'd expect given various bugs & rendering weirdnesses), including iOS, Gmail, Outlook 2003 / Express, etc.:

I traced the issue to my STYLE declaration, which uses the #font-face to pull in a custom font file for supporting clients (i.e. Apple). Apparently, something about this use of the #font-face declaration breaks in Outlook 2007 - 20013.
<style>
#font-face {
font-family: proxima-nova;
src: url('http://assets/ProximaNova-Reg.otf');
}
#font-face {
font-family: proxima-nova-blk;
src: url('http://assets/ProximaNova-Black.otf');
}
</style>
I needed to get MS Outlook to ignore this STYLE tag, so I wrapped the entire block with the [if !mso] tag:
<!--[if !mso]><!-->
<style>
#font-face {
...
}
</style>
<!--<![endif]-->
Wow, that was driving me crazy.

I've tried your solution with the [if !mso] tag, but for some reason it wouldn't work. I eventually found a different solution:
You can use the font-tag with the face-attribute to force the right fallback-font in clients like Outlook 2007/2010/2013. For example:
<td style="color:#FFFFFF; font-weight:300;font-size:18px;">
<font face="proxima-nova,'Proxima Nova Regular','Proxima Nova',verdana,sans-serif"
</td>
I tested this in Litmus and in Outlook 2007/2010/2013 it would fallback to Verdana and in clients who do support the custom font, it would show proxima-nova.
I hope this helps.

Related

Remove Text Padding/Margin inside VML Shape

I'm trying to figure out how to get this text (!) to show up. Even though it's smaller than the circle it's in, it still gets cut off about 1/3 of the way in to the circle.
I would like to use this for Outlook specifically.
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" style="height:20px;v-text-anchor:middle;width:20px;" arcsize="50%" stroke="f" fillcolor="#ffcb05">
<center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">!</center>
</v:roundrect>
Anyone have any ideas? I've tried overflow:visible on the circle to no avail.
More information
Using a macro to get test html into Outlook.
It is most definitely some sort of margin or padding on the v:roundrect element. After importing the HTML, I can right click, go to Format Shape, then Layout & Properties, which gives me the 4 "margin" options. Setting them to zero gives me the desired effect. The issue is that I cannot then grab this HTML, and I have no idea what property this is correlating to.
Latest code:
<v:roundrect style="height:30px;width:30px;margin:0 !important;padding:0 !important; mso-margin-bottom-alt:0 !important;mso-margin-top-alt:0 !important;mso-margin-right-alt:0 !important;mso-margin-left-alt:0 !important;mso-padding-bottom-alt:0 !important;mso-padding-top-alt:0 !important;mso-padding-right-alt:0 !important;mso-padding-left-alt:0 !important;" arcsize="50%" strokeweight="2px" strokecolor="#FFFFFF" fillcolor="#ffcb05" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word">
<center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;margin:0 !important;padding:0 !important;mso-margin-bottom-alt:0 !important;mso-margin-top-alt:0 !important;mso-margin-right-alt:0 !important;mso-margin-left-alt:0 !important;mso-padding-bottom-alt:0 !important;mso-padding-top-alt:0 !important;mso-padding-right-alt:0 !important;mso-padding-left-alt:0 !important;">!</center>
</v:roundrect>
I've attempted using different elements (span, p, etc..) instead of center.
Textbox with zeroed inset is the key. I had tried it before, but without nested html. Text directly input in the v:textbox element does not appear to work, so I used a center element to encapsulate text and set styles.
<v:roundrect style="height:20px;width:20px;" arcsize="50%" strokeweight="2px" strokecolor="#FFFFFF" fillcolor="#ffcb05" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word">
<v:textbox inset="0,0,0,0">
<center style="font:300 14px/15px Impact, Sans-serif;color:#FFFFFF;mso-line-height-rule:exactly;">!</center>
</v:textbox>
</v:roundrect>
It might help to solve your problem: https://buttons.cm/
You might try adding line-height: 16px; mso-line-height-rule: exactly; to the center style attributes. Outlook, particularly later versions, tends to tack on a lot of extra spacing above and below text, and won't follow your line height unless you force it.

Bold characters merge with normal characters

I send my customer newsletter with bold characters indicate that they combine the regular characters.
When i m using tag same problem. Any Idea?
My code here.
<tr>
<td style="font-family:Tahoma, Geneva, sans-serif; color:#000; font-size:13px; padding:20px">Hailed by<b>Apple CEO Tim Cook</b> as<b>"the biggest news in iPad since the iPad"</b> at its launch event in San Francisco, the extra-large<b>iPad Pro</b> is a new<b>12.9-inch tablet</b> as<b>thin as</b> the<b>iPad Air</b> and powered by the new<b>A9x 64-bit chip</b>. <br />
<br />
Running on Apple's latest software,<b>iOS 9, the iPad Pro</b> will work with a<b>stylus, dubbed Apple Pencil</b>, and a<b>smart keyboard accessory</b>. The<b>Smart Keyboard</b>, a keyboard especially for the<b>iPad Pro</b>, looks a lot like the one for the<b>Microsoft Surface Pro 3</b>, and<b>works similarly</b>. It was launched alongside an updated<b>iPad Mini 4</b>and<b>lower pricing</b> for the rest of the iPad line-up. Read more here. </td>
</tr>
<tr>
Note: My client is using Outlook with Office 360.
outlook screenshot
You have a spacing issue on the 4th line:
... updated<b>iPad Mini 4</b>and<b>lower pricing</b> ...
Just add the respective spaces and you should be fine:
... updated <b>iPad Mini 4</b> and <b>lower pricing</b> ...
This mistake is repeated in several places, so for better optimization, just use spaces before/after every tag you use and no spaces within the tag. This was, you'll be rid of such errors in the future :)

How to stop TinyMCE removing <p> inside <td>

I'm currently suffering from TinyMCE (v=3.5.8) removing html from a customer's CMS-installation. In old versions there was cleanup:false and cleanup_on_startup but 3.4+ those are deprecated. However, I struggle to fix the behaviour. First off the code it is messing with:
Before:
<td><p align="center">
<strong><span style="color: #336600; font-family: georgia,times new roman,times,serif; font-size: x-large;">
Text<br>Text<br>Text<br>Text
</span></strong>
</p></td>
After clicking into table cell
<td>
<strong><span style="color: #336600; font-family: georgia,times new roman,times,serif; font-size: x-large;">
Text<br>Text<br>Text<br>Text
</span></strong>
</td>
So the question is, why doesn't the following init-params stop the behaviour?
// Skin options
skin : "o2k7",
skin_variant : "silver",
// custom params from attribute tinyparams
verify_html:false,
fix_table_elements:false,
schema:"html4",
valid_children: "+body[style],+td[p],+tr[p],+th[p],+tbody[p],+table[p]"
From my understanding, it is the process of validating children rules that removes my Paragraph-Tag. I was also using valid_elements with the full xhtml ruleset mentioned here http://www.tinymce.com/wiki.php/Configuration3x:valid_elements
Anybody got a clue what is going on here? I would be thankfull for any hints.
Set the below option so that it doesn't check your HTML for errors.
verify_html : false

Markdownize an Emacs buffer

I am looking for a Markdown variant of the Htmlize addon.
The idea is simple: say, you wish to publish code to a GIST on GitHub, or any place which supports Markdown. You type your code in Emacs, do M-x markdownize-buffer and you get a new buffer containing the full Markdown markup.
Anybody knows if such an addon exists?
Markdown isn't powerful enough to generate span classes. To do this, you need to drop down into pure HTML.
Htmlize will generate a syntax-highlighted version of your code based on your current Emacs theme settings. Take a look at the generated markup: it does this by generating both DOM elements and styles to replicate your current syntax highlighting:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!-- Created by htmlize-1.36 in css mode. -->
<html>
<head>
<title>sha1test.rb</title>
<style type="text/css">
<!--
body {
color: #eeeeec;
background-color: #2e3434;
}
.comment {
/* font-lock-comment-face */
color: #888a85;
}
.comment-delimiter {
/* font-lock-comment-delimiter-face */
color: #888a85;
}
/* [...] */
-->
</style>
</head>
<body>
<pre>
require <span class="string">'digest/sha1'</span>
<span class="type">SLICE_SIZE</span> = 20
<span class="keyword">def</span> <span class="function-name">myhash</span>(input)
<span class="type">Digest</span>::<span class="type">SHA1</span>.hexdigest(input).slice(0,<span class="type">SLICE_SIZE</span>)
<span class="keyword">end</span>
hashmap = {}
inputs = 0
unique_inputs = 0
<span class="type">ARGF</span>.each <span class="keyword">do</span> |line, idx|
[...]
</body>
</html>
Markdown can't replicate the kind of information here. It's good for translating semantic plain-text into semantic markup (i.e. headers should turn into H1 or H2, **text** should generate <strong>text</strong>, etc.). Which lines of your Emacs buffer are headers? Which should translate into <em> tags?

Unicode and fonts

This is something that I don't see much discussed. I'm developing a software that will support multilingualism, thus, I would need to use Unicode compatible fonts, right? Where could I possibly find such fonts and how would I know for sure they support Chinese, Korean, Japanese, whatever there exist?
It's a shame you can't use beautiful fonts found in the Internet, because most of them support ASCII only.
Just to make sure: do not expect to find a font that supports Chinese Traditional, Chinese Simplified, and Japanese.
There are glyph differences for the same Unicode code points, so a native user will immediately spot that you are not using the proper font for their language.
For a web application it is probably best to give a list of fonts, and in the list you need a typical Windows font, a typical Mac font, and a generic one (like "serif").
Tagging the html page (or the paragraph) with the proper lang tag will help some (smarter) browsers to select the right font if the specific ones are not installed.
From my unicode/font bookmark collection
http://en.wikipedia.org/wiki/Category:Free_software_Unicode_typefaces
http://en.wikipedia.org/wiki/Unicode_typefaces
http://unifoundry.com/unifont.html
http://www.fileformat.info/info/unicode/font/index.htm
http://www.alanwood.net/unicode/fontsbyrange.html
http://www.alanwood.net/unicode/fonts.html
http://www.unifont.org/fontguide/
http://www.wazu.jp/index.html
http://www.alanwood.net/unicode/fonts.html
Alan Wood's site has alot of Unicode fonts. By each font there is a list explaining which languages is supported by it.
Another great site is the fontguide at Unifont. To find it just google for it, don't have the reputation to link it yet. When there, just click the continent-tabs at top of the site to view fonts including languages from those countries.
You can create your own custom webfonts with tools like the Icomoon App.
The Icomoon App allows you to do each of the following :
Get one or more icons from several popular icon fonts
Upload other fonts, which may be icon fonts but also regular fonts
Upload SVG files to use as glyphs
Combine any number of glyphs from any number of available fonts
Set the UNICODE hex value for whichever characters you need
Export and/or save the font set you create
I used the Icomoon App to create the Emoji emoticon font as well as for creating custom icon fonts on a per project basis.
To include an icon font in your CSS, you can include 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
}
.icon {
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
}
To use an icon in your HTML, you can do each of the following :
<!-- Method 1 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family for an entire HTML element -->
<!-- Define your icon fonts in your CSS font-family after your regular fonts -->
<!-- This means that regular characters are default. Icons are a fallback -->
<!-- Use UTF-8 characters directly in your HTML for improved human readability -->
<div class="rate"><p>I rate this movie ★★★★☆!!</p></div>
<!-- Method 2 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family for an entire HTML element -->
<!-- Define your icon fonts in your CSS font-family after your regular fonts -->
<!-- This means that regular characters are default. Icons are a fallback -->
<!-- Use entity codes in your HTML when UTF-8 support is uncertain -->
<div class="rate"><p>I rate this movie ★★★★☆!!</p></div>
<!-- Method 3 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family only for the icons but not the HTML elements that include them -->
<!-- Define your icon fonts in your CSS font-family before your regular fonts -->
<!-- This means that icons are default. Regular characters are a fallback -->
<!-- Use UTF-8 characters directly in your HTML for improved human readability -->
<p>I rate this movie <span class="icon">★★★★☆</span>!!</p>
<!-- Method 4 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family only for the icons but not the HTML elements that include them -->
<!-- Define your icon fonts in your CSS font-family before your regular fonts -->
<!-- This means that icons are default. Regular characters are a fallback -->
<!-- Use entity codes in your HTML when UTF-8 support is uncertain -->
<p>I rate this movie <span class="icon">★★★★☆</span>!!</p>
<!-- Method 5 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family only for the icons and use a separate HTML tag for each icon -->
<!-- Define your icon fonts in your CSS font-family before your regular fonts -->
<!-- This means that icons are default. Regular characters are a fallback -->
<!-- Use UTF-8 characters directly in your HTML for improved human readability -->
<p>I rate this movie
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">☆</span>
!!
</p>
<!-- Method 6 -->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family only for the icons and use a separate HTML tag for each icon -->
<!-- Define your icon fonts in your CSS font-family before your regular fonts -->
<!-- This means that icons are default. Regular characters are a fallback -->
<!-- Use entity codes in your HTML when UTF-8 support is uncertain -->
<p>I rate this movie
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">★</span>
<span class="icon">☆</span>
!!
</p>
<!-- Method 7-->
<!--- * * * * * * * * * * * * -->
<!-- Set a font-family only for the icons and use a separate HTML tag for each icon -->
<!-- Define your icon fonts in your CSS font-family before your regular fonts -->
<!-- This means that icons are default. Regular characters are a fallback -->
<!-- Use the 'content' style rule with a ':before selector' in your CSS -->
<p>I rate this movie
<span class="icon icon-star"></span>
<span class="icon icon-star"></span>
<span class="icon icon-star"></span>
<span class="icon icon-star"></span>
<span class="icon icon-star-unfilled"></span>
!!
</p>
If you want to opt for method 7, you'll need some additional CSS code. This CSS code would look like this :
.icon-star:before {
content: "\2605";
}
.icon-star-unfilled:before {
content: "\2606";
}
Icon fonts like Iconic, Font Awesome or Glyphicons typically all use method 7. This, to avoid you having to copy-paste special characters from a cheat sheet or being forced to use HTML entities.
It is, however, a method that has several downsides. First of all, it requires support for the :before CSS selector and the use of an escape sequence for UNICODE characters. Neither IE6-7 nor certain versions of Webkit provide this support.
Another downside is that you have to use a seperate HTML tag for each icon, with each tag corresponding to one character from the icon font. Displaying several icons within HTML tag is not possible with method 7, unlike with other methods.
Other methods have their own downsides, though. Methods 1, 3 and 5 require you to copy-paste the character from a cheat sheet or use means to put the character itself within your code. Your code editor may not be capable of displaying the character or it may display a different character from the one in your icon font if the icon font uses a non-standard mapping that character.
Methods 1, 3 and 5 also require that your browser uses the proper encoding to display the correct character. For UNICODE characters, this isn't as obvious as it is for ASCII characters. This should, however, be ensured by adding the meta-tag <meta charset="utf-8" /> somewhere in the head of your HTML-document.
Methods 2, 4 and 6 do not require you to copy-paste the character, however it makes your code less readable by humans and makes any changes to the code more prone to human error. Also, as you will need to look up the HTML-entity code for each of the icons you want to use or you'll need to memorize them. While the same obviously applies to the classes used in method 7 as well, those classes are much easier to memorize than an HTML entity code.