Skip to content

Instantly share code, notes, and snippets.

@sbhimavarapuAppc
Created September 29, 2011 18:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbhimavarapuAppc/1251565 to your computer and use it in GitHub Desktop.
Save sbhimavarapuAppc/1251565 to your computer and use it in GitHub Desktop.
Custom fonts in Webview - Android
// Make sure you have your custom font-file under Resources/fonts
var webview = Ti.UI.createWebView({
url: 'local_webview.html'
});
var window = Ti.UI.createWindow();
window.add(webview);
window.open();
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>local webview</title>
<meta name="format-detection" content="telephone=no"/>
<style type="text/css">
@font-face{
font-family: "chantelli_antiqua";
src: url('file:///android_asset/Resources/fonts/Chantelli_Antiqua.ttf');
}
body {
font-family: "Chantelli_Antiqua";
}
</style>
</head>
<body id="mybody" style="height:500px;background-color:#999">
Hello from local webview. You should see an indicator in the middle and my text should be blue.
<div>323-223-2222</div>
<a href="http://www.google.com">google</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment