text-rendering

Part 2 - How do I get consistent rendering when scaling a JTextPane?

耗尽温柔 提交于 2019-11-28 02:06:53
I submitted another version of this question and a sample program before: How do I get consistent rendering when scaling a JTextPane? Recapitulating the problem: I would like to allow users to zoom into or out of a non-editable JTextPane. Running the example program submitted in the earlier question, which simply scaled the Graphics object, resulted in inconsistent spacing between runs of bold text and non-bold text. The sample program below attempts to solve the problem by drawing the text pane to a BufferedImage at 100% and then scaling the image. This solves the problem of inconsistent

Draw text with custom font using ImageMagick and PHP

僤鯓⒐⒋嵵緔 提交于 2019-11-28 02:04:28
问题 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

PIL cuts off top of letters

帅比萌擦擦* 提交于 2019-11-28 01:21:28
I've spent a lot of time making my first web application using Python, and I'm using pil for generating images. After reading a lot, I've managed to implement proper text aligning, wrapping, generating files with many extensions etc. However, all the text generated by PIL is cut off at the top. Here's a sample. It should say ŻÓĆjygpq in a variety of fonts (the font names are on the left). I've found few posts here: fonts clipping with PIL , but I'd like to avoid using another module (aggdraw); since I've figured out so many things in PIL already I'd like to stick to that. I've tried many fonts

Supporting complex text layout with OpenType fonts in Android

牧云@^-^@ 提交于 2019-11-28 00:35:05
What I would like I would like to put an OpenType font in my assets folder and use Typeface.createFromAsset to render Unicode text in my Android application for a language that uses complex text layout (CTL) . Background I want to do this for traditional Mongolian script , but it is the same issue (so I hear) for other languages like Thai, Arabic, Indic languages, and many minority languages. An OpenType font already includes the information necessary to properly display the text. The problem is that not all software supports OpenType rendering. Some do , but others don't. From what I can

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

寵の児 提交于 2019-11-28 00:21:08
问题 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? 回答1: 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 } }

How can I render curved text into a Bitmap?

混江龙づ霸主 提交于 2019-11-27 08:47:45
I am currently dynamically creating a bitmap and using the graphics object from the bitmap to draw a string on it like so: System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bmp); graph.DrawString(text, font, brush, new System.Drawing.Point(0, 0)); This returns a rectangular bitmap with the string written straight across from left to right. I would like to also be able to draw the string in the shape of a rainbow. How can I do this? I recently had this problem (I was rendering text for printing onto CDs), so here's my solution: private void DrawCurvedText(Graphics graphics,

IE 9 does not use sub-pixel antialiasing under certain conditions

亡梦爱人 提交于 2019-11-27 08:04:56
[Original title: IE 9 text renders very poorly; is there a workaround? ) IE 9 is rendering the text in my application very poorly. The problem is not in my monitor's Clear Type settings, since IE 9 in compatibility mode, Firefox, and Chrome all render text nicely. Here's a side-by-side comparison of how the text is rendered with IE 9, IE 9 in compatibility mode, and Chrome: I tried applying this answer , but it doesn't seem to apply to anything after IE 7. Does anybody know of any workarounds we can apply to our site to fix IE 9's bad text rendering? Edit: I've boiled down the problem page to

OpenGL font rendering using Freetype2

旧城冷巷雨未停 提交于 2019-11-27 06:54:37
问题 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

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

偶尔善良 提交于 2019-11-27 05:19:24
问题 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? 回答1: 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

PIL cuts off top of letters

我是研究僧i 提交于 2019-11-26 23:30:25
问题 I've spent a lot of time making my first web application using Python, and I'm using pil for generating images. After reading a lot, I've managed to implement proper text aligning, wrapping, generating files with many extensions etc. However, all the text generated by PIL is cut off at the top. Here's a sample. It should say ŻÓĆjygpq in a variety of fonts (the font names are on the left). I've found few posts here: fonts clipping with PIL, but I'd like to avoid using another module (aggdraw);