티스토리 툴바



2012/01/25 20:29

WebView 폰트 사용

Chrome, Safari 에서 웹 폰트를 사용하기 위해서는 css 파일에 다음과 같이 font-face를 지정하고 사용하면 가능하다.
폰트 종류는 데스크탑 브라우저에서는 woff, ttf 가 가능하고, iOS 모바일 브라우저에서도 woff가 가능하지만, 안드로이드에서는 ttf만 적용 가능하다. 

그리고 반드시 font-face에서 format('ttf') 속성을 제거해야만 사용이 가능하다.

@font-face{ font-family: '나눔손글씨 펜'; font-weight: normal; font-style: normal; src:url('NanumPen.ttf');}



안드로이드 웹뷰에서 폰트 미적용으로 고생하고 있다면 이것으로 처리하자.
url 은 app 내에 assets 파일에 포함할 수도 있고, 웹 서버가 있다면 url 경로로 지정할 수 있다.

예)  @font-face{ font-family: '나눔손글씨 펜'; font-weight: normal; font-style: normal; src:url('file:///android_asset/NanumPen.ttf');}



폰내에서 로컬서버를 띄우던, file:// 로 서비스를 하던, 원격 서버의 url을 가지던 동일하게 동작한다. 

이걸로 내가 잃어버린 시간을 누군가 세이브 하시길...


Trackback 0 Comment 0
2011/12/04 10:24

Android 리스트뷰와 프로필 이미지 캐싱

FastScrollView
  http://blog.naver.com/PostView.nhn?blogId=dukci&logNo=50105870579&redirect=Dlog&widgetTypeCall=true

정렬 가능한 목록
  http://www.androidpub.com/1860903


트위터 프로필 이미지 캐싱
http://codehenge.net/blog/2011/06/android-development-tutorial-asynchronous-lazy-loading-and-caching-of-listview-images/


이미지 레이지 로딩 리스트
https://github.com/thest1/LazyList 

http://androidsnips.blogspot.com/2010/08/lazy-loading-of-images-in-list-view-in.html


웹뷰와 EditText 같이 있을 경우 포커스를 webview에서 받지 못함
http://blog.naver.com/PostView.nhn?blogId=pnh97121&logNo=80123307448

최초 화면 로딩시 editText에 포커스를 가지게 되어 키보드가 나타남
http://stackoverflow.com/questions/5056734/android-force-edittext-to-remove-focus

ㅇㅇ
Trackback 0 Comment 0
2011/11/09 15:41

웹폰트 font-weight:bold; 속성이 적용받지 못하는 상황


웹 폰트를 적용할 경우 다음과 같이 font-weigth 속성을 제외하고 선언할 경우 bold 속성이 적용되지 않는 문제를 확인했습니다.

@font-face{
    font-family: '나눔고딕';
    src:url('../font/NanumGothic.woff') format('woff');
}


따라서 웹 폰트 이용시에는 font-weight를 다음과 같이 적용하여야 합니다.

@font-face{ 
    font-family: '나눔고딕'; 
    font-weight: normal; 
    font-style: normal; 
    src:url('../font/NanumGothic.woff') format('woff'); 
}


style속성중 font-weight:bold; 가 적용됨을 확인할 수 있습니다.

ps) 근데... 시스템 폰트에서 bold 보다 조금 더 굵게 보이는건 착각이려나.... ㅡㅡ; 
Trackback 0 Comment 0