How can I create an email using a specific font?

时光怂恿深爱的人放手 提交于 2020-01-07 04:53:09

问题


I have made an applications which has specific font (handwriting.ttf), it works absolutely fine in application but when I email the text written in this font through my application - the font becomes gibrish on receivers end (the reason is that receiver does not have this perticular font in his computer)

I have seen another application that sends text via email using custom font. This gives me confidence that functionality like this works - but I dont kow how?


回答1:


When you say gibberish, do you mean that the user is seeing the copy, but with the alignment and other graphical elements getting screwed up, or that you literally see something entirely incomprehensible. I would have expected your font tag to have a series of fonts and that the email would have fallen back to one of the more standard fonts if the attempt to use the custom font failed. Please update your original question with (a) the code that you're using to create your email body, as well as (b) a screen snapshot of how it's rendered in the email client.

Two immediate suggestions:

  1. If you know of other apps that are sending email with a custom font (which I'm surprised by, but I'll take your word for it), have one of them send you an email and then view the source of that email and see what it's putting in the email's html and examine how it's doing it;

  2. Most emails I get that are employing specialized fonts are also incorporating all sorts of graphical elements and it's sending the email as an image (which you can either embed in-line in the html-based email using base64, or put on some server and link to the <img> there), frequently with a text rendition, too. You can use Quartz 2D to create those images that you then embed in your email. Clearly this won't work in all situations, but using images for the body of the email, or PDFs (which you can also generate from the app) for attachments seems to be more common.

Personally, I'd shy away from embedding custom fonts in the html body of the email because you're subject to the vagaries of how the user's email client renders custom fonts, if at all. Plus you'd want to do some exhaustive testing, examining the email in different email clients (as @meccan's commented link had done). If the look and feel of the resulting email are critical and highly stylized, and if the content of the email is relatively short, I'd lean towards option 2.



来源:https://stackoverflow.com/questions/10428672/how-can-i-create-an-email-using-a-specific-font

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!