How to determine the size of a string given a font

It depends on the rendering engine being used. You can basically switch between GDI and GDI+. Switching can be done by setting the UseCompatibleTextRendering property accordingly When using GDI+ you should use MeasureString: string s = “A sample string”; SizeF size = e.Graphics.MeasureString(s, new Font(“Arial”, 24)); When using GDI (i.e. the native Win32 rendering) you … Read more

italic, bold and underlined font on iPhone

You have to actually ask for the bold, italic version of a font. For example: UIFont *myFont = [UIFont fontWithName:@”Helvetica-BoldOblique” size:[UIFont systemFontSize]]; To get a list of everything available on the iPhone, put this little snippet in your applicationDidFinishLaunching: delegate method and look at the log output: for (NSString *family in [UIFont familyNames]) { NSLog(@”%@”, … Read more

How to install a Font programmatically (C#)

As you mentioned, you can launch other executables to install TrueType Fonts for you. I don’t know your specific use cases but I’ll run down the methods I know of and maybe one will be of use to you. Windows has a built-in utility called fontview.exe, which you can invoke simply by calling Process.Start(“Path\to\file.ttf”) on … Read more

How to add a custom font to Rails app?

Checkout http://www.css3.info/preview/web-fonts-with-font-face/ Larger example, assuming they’re resolved directly under the assets dir @font-face { font-family: ‘Nokia Pure Headline’; src: url(‘/assets/nokiapureheadlinerg-webfont.eot’); src: url(‘/assets/nokiapureheadlinerg-webfont.eot?iefix’) format(‘eot’), url(‘/assets/nokiapureheadlinerg-webfont.woff’) format(‘woff’), url(‘/assets/nokiapureheadlinerg-webfont.ttf’) format(‘truetype’), url(‘/assets/nokiapureheadlinerg-webfont.svg#webfont3AwWkQXK’) format(‘svg’); font-weight: normal; font-style: normal; } Im sorry I dont know LESS Also for the config of the assets pipeline to have the contents of assets/fonts available … Read more

Django – New fonts?

For the directory structure like so, — static |–fonts | |–abc.ttf | |–css |– main.css In the main.css, you should add. @font-face { font-family: ‘abc’; src: local(‘Abc’), url(‘../static/fonts/abc.ttf’) format(“truetype”); } You can’t use {% static ‘filename’ %} inside a css file, since it will not be rendered by the django templating engine. Also, if you … Read more

Make font italic and bold

System.Drawing.Font MyFont = new System.Drawing.Font( thisTempLabel.LabelFont, ((float)thisTempLabel.fontSize), FontStyle.Bold | FontStyle.Italic, GraphicsUnit.Pixel ); Maybe you wanted to use the OR operator (|)

How to set a custom font to the title in toolbar android

Since android.support.v7.appcompat 24.2 Toolbar has method setTitleTextAppearance and you can set its font without external textview. create new style in styles.xml <style name=”RobotoBoldTextAppearance”> <item name=”android:fontFamily”>@font/roboto_condensed_bold</item> </style> and use it mToolbar.setTitleTextAppearance(this, R.style.RobotoBoldTextAppearance);