Using a custom typeface in Android

Yes It is possible. You have to create a custom view which extends text view. In attrs.xml in values folder: <resources> <declare-styleable name=”MyTextView”> <attr name=”first_name” format=”string”/> <attr name=”last_name” format=”string”/> <attr name=”ttf_name” format=”string”/> </declare-styleable> </resources> In main.xml: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:lht=”http://schemas.android.com/apk/res/com.lht” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <TextView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello”/> <com.lht.ui.MyTextView android:id=”@+id/MyTextView” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”Hello friends” lht:ttf_name=”ITCBLKAD.TTF” /> … Read more

Webfonts or Locally loaded fonts?

First, I’ll clear something up about Google’s offering. It will actually load the smallest format your browser can handle. WOFF offers small file sizes, and your browser supports it, so it’s the one you see. WOFF is also fairly widely supported. However, in Opera for example, you’ll probably get the TrueType version of the font. … Read more

android set custom font to a paint

If by “custom font” you mean a font that you are supplying as an asset, the following code should work: Typeface plain = Typeface.createFromAsset(assetManager, pathToFont); Typeface bold = Typeface.create(plain, Typeface.DEFAULT_BOLD) Paint paint = new Paint(); paint.setTypeface(bold); canvas.drawText(“Sample text in bold”,0,0,paint);

Webfont Smoothing and Antialiasing in Firefox and Opera

As Opera is powered by Blink since Version 15.0 -webkit-font-smoothing: antialiased does also work on Opera. Firefox has finally added a property to enable grayscaled antialiasing. After a long discussion it will be available in Version 25 with another syntax, which points out that this property only works on OS X. -moz-osx-font-smoothing: grayscale; This should … Read more

How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?

Once you go past 100% (or 125% with the “XP-style DPI scaling” checkbox ticked), Windows by default takes over the scaling of your UI. It does so by having your app render its output to a bitmap and drawing that bitmap to the screen. The rescaling of that bitmap makes the text inevitably look fuzzy. … Read more

Font size in CSS – % or em? [duplicate]

There’s a really good article on web typography on A List Apart. Their conclusion: Sizing text and line-height in ems, with a percentage specified on the body (and an optional caveat for Safari 2), was shown to provide accurate, resizable text across all browsers in common use today. This is a technique you can put … Read more

list every font a user’s browser can display

Yes there is! I’m so glad you asked this question because I now want to use this too. http://www.lalit.org/lab/javascript-css-font-detect Code from http://www.lalit.org/wordpress/wp-content/uploads/2008/05/fontdetect.js?ver=0.3 /** * JavaScript code to detect available availability of a * particular font in a browser using JavaScript and CSS. * * Author : Lalit Patel * Website: http://www.lalit.org/lab/javascript-css-font-detect/ * License: Apache Software … Read more

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