Custom fonts and XML layouts (Android)

You can extend TextView to set custom fonts as I learned here. TextViewPlus.java: package com.example; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.widget.TextView; public class TextViewPlus extends TextView { private static final String TAG = “TextView”; public TextViewPlus(Context context) { super(context); } public TextViewPlus(Context context, AttributeSet attrs) { super(context, attrs); setCustomFont(context, … Read more

CSS: bolding some text without changing its container’s size

I had the same problem, but got a similar effect with a little compromise, I used text-shadow instead. li:hover {text-shadow:0px 0px 1px black;} Here’s a working example: body { font-family: segoe ui; } ul li { display: inline-block; border-left: 1px solid silver; padding: 5px } .textshadow :hover { text-shadow: 0px 0px 1px black; } .textshadow-alt … Read more

How do I install a custom font on an HTML site

Yes, you can use the CSS feature named @font-face. It has only been officially approved in CSS3, but been proposed and implemented in CSS2 and has been supported in IE for quite a long time. You declare it in the CSS like this: @font-face { font-family: Delicious; src: url(‘Delicious-Roman.otf’); } @font-face { font-family: Delicious; font-weight: … Read more

Failed to decode downloaded font

In the css rule you have to add the extension of the file. This example with the deepest support possible: @font-face { font-family: ‘MyWebFont’; src: url(‘webfont.eot’); /* IE9 Compat Modes */ src: url(‘webfont.eot?#iefix’) format(’embedded-opentype’), /* IE6-IE8 */ url(‘webfont.woff2’) format(‘woff2’), /* Super Modern Browsers */ url(‘webfont.woff’) format(‘woff’), /* Pretty Modern Browsers */ url(‘webfont.ttf’) format(‘truetype’), /* Safari, … Read more

Dynamically changing font size of UILabel

Single line: factLabel.numberOfLines = 1; factLabel.minimumFontSize = 8; factLabel.adjustsFontSizeToFitWidth = YES; The above code will adjust your text’s font size down to (for example) 8 trying to fit your text within the label. numberOfLines = 1 is mandatory. Multiple lines: For numberOfLines > 1 there is a method to figure out the size of final … Read more

Multiple font-weights, one @font-face query

Actually there is a special flavor of @font-face that will permit just what you’re asking. Here’s an example using the same font-family name with different styles and weights associated with different fonts: @font-face { font-family: “DroidSerif”; src: url(“DroidSerif-Regular-webfont.ttf”) format(“truetype”); font-weight: normal; font-style: normal; } @font-face { font-family: “DroidSerif”; src: url(“DroidSerif-Italic-webfont.ttf”) format(“truetype”); font-weight: normal; font-style: italic; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)