font-size

Device settings independent font size

北慕城南 提交于 2019-12-02 00:52:10
问题 While developing my app I realised if someone changes device font size from normal, my application font sizes change too and it destroys some of the visuals I designed. So I wanted to ask if there is a way to fix text sizes independent from device's settings? Thanks 回答1: check the source code DisplaySettings.java, here is the method to control font size scale public void writeFontSizePreference(Object objValue) { try { mCurConfig.fontScale = Float.parseFloat(objValue.toString());

How to render text in .NET in the same size as browsers does given CSS for the text

血红的双手。 提交于 2019-12-01 22:26:30
问题 I am trying to create a "save webpage as bitmap"-function on a website and i have some problems rendering the text in the correct size on the server side. The fontsize settings for the text on the client is: .textDiv { font-family: Verdana; font-size:16px; } If i try to render this on the server with float emSize = 16; g.DrawString("mytext", new Font("Verdana", emSize), Brushes.Black, x, y); The text will become about 20% larger on the server. The documentation for new Font() says that the

Using fonts in PIL without freetype

人盡茶涼 提交于 2019-12-01 21:11:27
Hy, i'm using PIL (Python Image Library) without the lib-freetype. Is there a possibility to use fonts (i just have to resize a text, not more!) without installing the freetype? Or is there a possibility to set the size of a font, without setting the truetype of the font, so using the default truetype? It's for a project on a server, where i can just install pure PIL, without any extensions for supporting truetypes! Gareth Rees If you read the manual for the ImageFont module you'll see that the Python Imaging Library supports the PILFont format for bitmap fonts. So on your own computer, render

How to render text in .NET in the same size as browsers does given CSS for the text

China☆狼群 提交于 2019-12-01 21:08:51
I am trying to create a "save webpage as bitmap"-function on a website and i have some problems rendering the text in the correct size on the server side. The fontsize settings for the text on the client is: .textDiv { font-family: Verdana; font-size:16px; } If i try to render this on the server with float emSize = 16; g.DrawString("mytext", new Font("Verdana", emSize), Brushes.Black, x, y); The text will become about 20% larger on the server. The documentation for new Font() says that the second argument(the font size) should be specified in em-points. What exactly is one em-point? If i

Override em font-size when elements are nested

ぃ、小莉子 提交于 2019-12-01 20:30:49
问题 How do you override the font-size property when you have nested elements? Using !important doesn't seem to have any effect. div { font-size:6em; } p { font-size:1em !important; } span { font-size:1em; } - <html> <body> <div><span>span</span><p>paragraph</p></div> </body> </html>​ ​ http://jsfiddle.net/dvUTQ/ 回答1: Em's are relative sizes to their parent elements. http://jsfiddle.net/dvUTQ/3/ div#small { font-size:2em; } div#big { font-size:6em; } p { font-size:.5em; /* effective sizes: big:

JTextPane: How to set the font size

霸气de小男生 提交于 2019-12-01 18:34:38
问题 Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Scanner; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class Form extends JFrame {

JTextPane: How to set the font size

ぐ巨炮叔叔 提交于 2019-12-01 18:30:49
Please have a look at the following code import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Scanner; import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class Form extends JFrame { private JTextPane textPane; private JLabel results; private JPanel center,south; private FlowLayout

Android: How to change app font size from code

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 17:47:33
I have a requirement where I need to change the application font size based on user provided values. How can I do that? I have googled but it seems that this can only be done is from XML layouts. You can alter text size for textviews with textview.setTextSize(int_value); Is this what you meant? Call setTextSize() on each TextView (or other widgets that inherit from TextView , such as Button ). The only way I can think of is to extend TextView and make them check a global textSize variable on every onDraw(). It should not add too much overhead to the drawing. It seems like I cant change app

Rendered pIxel width data for each character in a browser's font

雨燕双飞 提交于 2019-12-01 17:20:06
I have a table column that needs to be limited to a certain width - say 100 pixels. At times the text in that column is wider than this and contains no spaces. For example: a_really_long_string_of_text_like_this_with_no_line_breaks_makes_the_table_unhappy I would like to calculate the width of text server-side and add an ellipsis after the correct number of characters. The problem is that I don't have data about the rendered size of the text. For example, assuming the browser was Firefox 3 and the font was 12px Arial. What would be the width of the letter "a", the width of the letter "b", etc.

前端笔记-1

时间秒杀一切 提交于 2019-12-01 16:20:43
前端写法,记录敲前端的写法: 大部分的功能都可以在 W3C HowTo 找到答案,本来想多打几遍,不过时间不允许,想到最好的方法就是拿来用,就直接在里面找自己想要实现的功能吧。 页面元素的position css position 边框无色写法 border-color:transparent; 图片相关 responsive web design 给图片加个class:img-responsive 实现随页面变动的样式 z-index是什么? 元素的层叠 这个有什么用呢?如果有元素是position:fixed,就有用了,因为它是页面固定的 li前面小圆点的删除 123 li{ list-style:none;} 可以消除小圆点 dropdown dropdown 的内置padding是左右20px 所以它的width至少要150px,否则会出现乱位置。 google material icon 在applicaiton.html.erb的head里面加入 12 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 实现google icon的使用 material icon size 12345678910111213 .material-icons.md