text-rendering

html italic letters protrude from their container (and may be cut by the next container' background)

限于喜欢 提交于 2019-11-29 15:02:11
To illustrate the problem (background has an alpha 0.2 for presentation purposes): http://jsfiddle.net/Novado/enhuc4jv/1/ <span style="font-family: impact; font-size: 500pt; font-style: italic;"> <span style="border: 1px dotted #000;background-color: rgba(10, 10, 10, 0.2);"><span style="border: 1px solid red;color: red;background-color: rgba(200, 0, 0, 0.2);">World</span>  </span><span style="border: 1px dotted green; background-color: rgba(200, 0, 0, 0.2);"><span style="border: 1px solid blue; color: blue;background-color: rgba(0,0,200,0.2);">World</span>  </span> </span> Lack of break

HarfBuzz getting started [closed]

≡放荡痞女 提交于 2019-11-29 14:14:28
问题 I cannot find the guide to get started with using HarfBuzz in my own app. I looked here: http://freedesktop.org/wiki/Software/HarfBuzz/ This seems to be the official page of HarfBuzz. I looked over Download, Building and Development sections. But I must be overlooking something. 回答1: Some good and simple examples are listed on Harfbuzz wiki, 1, 2 I suggest you a higher level library, Pango if you need layout things like line wrap and I guess you would find better doucmentation for it than

fonts clipping with PIL

ぐ巨炮叔叔 提交于 2019-11-29 10:58:41
This image was created with PIL. See how the g's and the y's are cut off in this image? How can I prevent this? http://img109.imageshack.us/img109/8874/screenshotep.png The code that created this image is pretty straight forward (abbreviated): import Image, ImageDraw, ImageFont im = Image.new("RGBA", (200, 200), 'white') draw = ImageDraw.Draw(im) font = ImageFont.truetype("VeraSe.ttf", 12) draw.text( (1, 1), " %s: " % "ggjyfFwe__", font=font, fill='black' ) draw.text( (1, 30), " %s" % 15, font=font, fill='black' ) im.show() I tried it with a few different fonts, and it always gets clipped.

Draw text with custom font using ImageMagick and PHP

吃可爱长大的小学妹 提交于 2019-11-29 08:43:48
I want to dynamically render text to an image with a custom font, preferably with the option to output directly or save to a file . And to automatically set the image size according to the font/size combination . I can already do this with GD, but it doesn't handle fonts where characters overlay each other. So now I'm looking to ImageMagick. I've found an example in the docs that seem to do what I want. Is this possible with php_magick? Especially the part where no image size is defined :) If it is not, can I make command-line magick output the raw image, so I can pass it directly to the

font-variant: small-caps; shows different font sizes using Chrome or Firefox

只谈情不闲聊 提交于 2019-11-29 06:52:56
font-variant: small-caps; font-size: 12px; Firefox: Capital letters: 12px Lowercase letters: 10px Chrome: Capital letters: 12px Lowercase letters: 8px How to harmonize that without using JavaScript? Webkit browsers display small-caps smaller than other browsers so.. You can use CSS media queries to easily sniff out webkit browsers like Chrome and Safari. Try something like this: @media screen and (-webkit-min-device-pixel-ratio:0) { .some-element-using-small-caps { font-size: .85em } } You can target the browsers individually by using css hacks like this: @-moz-document url-prefix() { /

Properly render text with a given font in Python and accurately detect its boundaries

喜夏-厌秋 提交于 2019-11-28 12:48:24
This might strike as something very simple, and I too thought it'd be, but it apparently isn't. I must've spent a week trying to make this work, but I for the love of me can't manage to do so. What I need I need to render any given string (only containing standard characters) with any given font (handwritten-like) in Python. The font must be loaded from a TTF file. I also need to be able to accurately detect its borders (get the exact start and end position of the text, vertically and horizontally), preferably before drawing it. Lastly, it'd really make my life easier if the output is an array

OpenGL font rendering using Freetype2

旧街凉风 提交于 2019-11-28 12:08:15
I'm trying to render a freetype font using OpenGL, following the example posted at http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_02 . I've been able to generate a texture atlas from the font, creating shaders and creating quads. What I seem to get stuck at is passing the texture to the shader and/or getting the correct UVs for my quads. Been struggling for a good while now and really need the help. The following is the struct I use to create my texture atlas. struct FontCharacter { float advanceX; float advanceY; float bitmapWidth; float bitmapHeight;

html italic letters protrude from their container (and may be cut by the next container' background)

為{幸葍}努か 提交于 2019-11-28 09:22:35
问题 To illustrate the problem (background has an alpha 0.2 for presentation purposes): http://jsfiddle.net/Novado/enhuc4jv/1/ <span style="font-family: impact; font-size: 500pt; font-style: italic;"> <span style="border: 1px dotted #000;background-color: rgba(10, 10, 10, 0.2);"><span style="border: 1px solid red;color: red;background-color: rgba(200, 0, 0, 0.2);">World</span>  </span><span style="border: 1px dotted green; background-color: rgba(200, 0, 0, 0.2);"><span style="border: 1px solid

Is it safe to use the CSS rule “text-rendering: optimizelegibility;” on all text?

一个人想着一个人 提交于 2019-11-28 04:20:20
I noticed this woo theme for example has it set on the HTML tag and therefore the whole site's text has it set. I read that it can cause performance problems but that was a while ago. Some people suggested only adding it to headers and big text. Have the rules changed now? Do browsers perform well with it? No: there have been many bugs over the years on various platforms which cause text not to be displayed or displayed incorrectly (see below). If your goal is to enable ligatures, there's actually standard property font-variant-ligatures defined in CSS Fonts Level 3 which offers full control:

fonts clipping with PIL

那年仲夏 提交于 2019-11-28 03:51:12
问题 This image was created with PIL. See how the g's and the y's are cut off in this image? How can I prevent this? http://img109.imageshack.us/img109/8874/screenshotep.png The code that created this image is pretty straight forward (abbreviated): import Image, ImageDraw, ImageFont im = Image.new("RGBA", (200, 200), 'white') draw = ImageDraw.Draw(im) font = ImageFont.truetype("VeraSe.ttf", 12) draw.text( (1, 1), " %s: " % "ggjyfFwe__", font=font, fill='black' ) draw.text( (1, 30), " %s" % 15,