typography

How do I style HTML5 canvas text to be bold and/or italic?

余生颓废 提交于 2019-12-03 04:06:59
问题 I'm printing text to a canvas in a pretty straight forward way: var ctx = canvas.getContext('2d'); ctx.font = "10pt Courier"; ctx.fillText("Hello World", 100, 100); But how can I change the text to bold, italic or both? Any suggestions to fix that simple example? 回答1: You can use any of these: ctx.font = "italic 10pt Courier"; ctx.font = "bold 10pt Courier"; ctx.font = "italic bold 10pt Courier"; For further information, here are a couple of resources: Dive into HTML5 How to display text in

How do I style HTML5 canvas text to be bold and/or italic?

强颜欢笑 提交于 2019-12-02 17:49:56
I'm printing text to a canvas in a pretty straight forward way: var ctx = canvas.getContext('2d'); ctx.font = "10pt Courier"; ctx.fillText("Hello World", 100, 100); But how can I change the text to bold, italic or both? Any suggestions to fix that simple example? Donut You can use any of these: ctx.font = "italic 10pt Courier"; ctx.font = "bold 10pt Courier"; ctx.font = "italic bold 10pt Courier"; For further information, here are a couple of resources: Dive into HTML5 How to display text in canvas HTML5 canvas - the basics Just an additional heads up for anyone who stumbles across this: be

How to create small SPACES in HTML?

﹥>﹥吖頭↗ 提交于 2019-12-02 17:35:32
There is em dash and en dash. Is there an "en" equivalent to   ? Is there an en equivalent to pure Ascii 32 ? I want a better way to write this: 123<span class="spanen"> </span>456<span class="spanen"> </span>789 or this: 123<span class="spanen"> </span>456<span class="spanen"> </span>789 ANeves Don't use hacks that make no sense. If you wish to separate some words, I suggest you use the CSS property word-spacing : .strangeNumbers { word-spacing: 0.5em; } <span class="strangeNumbers">123 456</span>   (thin space) should do and   has not the same with as an — (—), to separate numbers you should

Centering a capital letter with max. possible dimensions in a circle

杀马特。学长 韩版系。学妹 提交于 2019-12-01 13:53:51
I require below requirements with pure CSS. What I tried unsuccessfully for my aim at http://jsfiddle.net/5rH5R/ what I try to achieve with a generic image: and verbally: One letter in a circle which is centered in both directions Letter in circle will be dynamic so CSS setting shouldn't be for some specific letters only (will be the first letter of the comment author's name) diameter of the circle may be changed in the future (40px for the time being) letter must not overflow out of the circle letter must be as large as possible I don't have any font-family restriction. If answer requires

Centering a capital letter with max. possible dimensions in a circle

只谈情不闲聊 提交于 2019-12-01 13:16:36
问题 I require below requirements with pure CSS. What I tried unsuccessfully for my aim at http://jsfiddle.net/5rH5R/ what I try to achieve with a generic image: and verbally: One letter in a circle which is centered in both directions Letter in circle will be dynamic so CSS setting shouldn't be for some specific letters only (will be the first letter of the comment author's name) diameter of the circle may be changed in the future (40px for the time being) letter must not overflow out of the

good way to write “pointer to something” in C/C++

☆樱花仙子☆ 提交于 2019-12-01 06:30:41
问题 Is there a "good" way to write "pointer to something" in C/C++ ? I use to write void foo( char *str ); But sometimes I find it quite illogical because the type of str is "pointer to char", then it should more logical to attach the * to the type name. Is there a rule to write pointers ? char*str; char* str; char *str; char * str; 回答1: The common C convention is to write T *p , whereas the common C++ convention is to write T* p . Both parse as T (*p) ; the * is part of the declarator, not the

align headings to same baseline, regardless following text?

十年热恋 提交于 2019-12-01 04:13:22
is there a way to align first line of multiple headings of various size to the same baseline? Also regardless to the text that follows, which should be aligned as well. See picture at http://snapplr.com/snap/z1mw please EDIT: re-uploaded: alt text http://img144.imageshack.us/img144/7615/screenshot2010021722h53.png It seems to me the only solution is to put each heading and each body text into separate DIV and then with headings to play with padding-top or margin-top to align them (e.g. H1 would be 36px with 0px margin, while H3 would be 24px with 12px top margin). Something like this: <html>

How to print subscripts/superscripts on a CLI?

◇◆丶佛笑我妖孽 提交于 2019-11-30 20:57:50
I'm writing a piece of code which deals with math variables and indices, and I'd need to print subscripts and superscripts on a CLI, is there a (possibly cross-platform) way to do that? I'm working in vanilla C++. Note: I'd like this to be cross-platform, but since from the first answers this doesn't seem to be possible I'm working under MacOS and Ubuntu Linux (so bash). Thank you Since most CLIs are really only terminals (pretty dumb ones mostly but sometimes with color), the only cross-platform way I've ever done this is by allocating muliple physical lines per virtual line, such as: 2 f(x)

Sentence Spacing [closed]

痞子三分冷 提交于 2019-11-30 18:08:05
What is the best way to present the additional spacing that should come between sentences (using [X]HTML+CSS)? <p>Lorem ipsum. Dolor sit amet.</p> ^^ wider than word spacing Since HTML and XML both require whitespace folding, the above two spaces must behave as a single space. What options are there?  There are a few obvious ones below, what others exist?  (Anything in CSS3?)  What drawbacks, if any, exist for the these, including across different browsers?  (How do the non-breaking spaces below interact with line wrapping?) ..ipsum.  Dolor.. ..ipsum.  Dolor.. ..ipsum.  Dolor.. There's a lot

css for double height text and double width text in font style

拜拜、爱过 提交于 2019-11-30 14:25:05
问题 Any one can help me to do double height text and double width text in font style(as like in dot matrix printers) in css without using any images. Any code other than this? heading{ font-weight:bold; width:200%; } What I expect is as below. Thanks. 回答1: OP, Updated fiddle that includes all vendor prefixes for transform and transform-origin :http://jsfiddle.net/LTaAy/1/ See this fiddle: http://jsfiddle.net/LTaAy/ IMG HTML <p class="doubleWidth">DOUBLE WIDTH</p> <p class="doubleHeight">Double