OSX 10.6, 나눔글꼴을 시스템 기본 글꼴로 사용하기. (plist, scripts)
참고 : http://clien.career.co.kr/cs2/bbs/board.php?bo_table=lecture&wr_id=87413
OS X 의 폰트 위치 :
/System/Library/Fonts/
/Library/Fonts/
~/Library/Fonts/
참고(Apple Support) : Mac OS X: Font Locations and Their Purposes
1. 나눔 폰트 설치.
$ ls /System/Library/Fonts/NanumGothic*
/System/Library/Fonts/NanumGothic.ttf
/System/Library/Fonts/NanumGothicBold.ttf
/System/Library/Fonts/NanumGothicCoding.ttf
/System/Library/Fonts/NanumGothicCodingBold.ttf
/System/Library/Fonts/NanumGothicExtraBold.ttf
$ ls /Library/Fonts/Nanum*
/Library/Fonts/NanumBrush.ttf
/Library/Fonts/NanumMyeongjo.ttf
/Library/Fonts/NanumMyeongjoBold.ttf
/Library/Fonts/NanumMyeongjoExtraBold.ttf
/Library/Fonts/NanumPen.ttf
참고.1
AppleGothic이 /System/Library/Fonts/ 쪽에 있어서 나눔고딕과 나눔고딕코딩을 넣었다.
AppleMyeongjo가 /Library/Fonts/ 에 있어서 나눔고딕 관련 폰트 이외의 폰트를 이쪽에 넣었다.
참고.2
하나더 otf 폰트는 FontForge ( http://fontforge.sourceforge.net/ ) 를 사용해서
폰트명(NanumGothicOTF00)을 알아보고 적용하려고 했는데 잘 안되는 것 같다.
otf 폰트는 모두 ~/Library/Fonts/ 폰더에 넣었다.
참고.3
/System/Library/Fonts 쪽에 한글 관련 폰트를 몰아 넣어 봤는데…
좀 꼬이는 것 같다. 궁서체가 나오기도 하고 명조체가 나오기도 하고 잘 안되서
되도록이면 /System/Library/Fonts 쪽에는 원래 있던 것은 그대로 두고
나눔 고딕 관련되 폰트(ttf)만 copy를 했다.
2. 폰트 관련 plist 수정.
2.1 나눔폰트 plist 교체
첨부한 압축파일 안에 스크립트를 이용해 원래의 plist를 교체한다.
주의)
원본을 .orig 으로 백업을 하긴 하나 install.sh는 여러번 동작을 고려하지 않았으므로
원본에 덮어써질 수 있습니다. install.sh를 여러번 동작하면 원본을 잃어버립니다.
이 문서는 참고용이니 A/S는 없습니다.
$ sudo ./install.sh
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources/DefaultFontFallbacks.plist -> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources/DefaultFontFallbacks.plist.orig
DefaultFontFallbacks.plist -> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources/DefaultFontFallbacks.plist
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSFontFallbacks.plist -> /System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSFontFallbacks.plist.orig
NSFontFallbacks.plist -> /System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSFontFallbacks.plist
2.2 백업 plist로 원복
$ sudo ./uninstall.sh
Password:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources/DefaultFontFallbacks.plist.orig -> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreText.framework/Versions/A/Resources/DefaultFontFallbacks.plist
/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSFontFallbacks.plist.orig -> /System/Library/Frameworks/AppKit.framework/Versions/C/Resources/NSFontFallbacks.plist
파일 다운로드 : OSX_NanumFontsInst-20111219.tar.bz2
https://skydrive.live.com/embed?cid=178B0421499A7B0A&resid=178B0421499A7B0A%21255&authkey=AJtMpm6cP3srPK8
압축파일 목록 :
$ ls
DefaultFontFallbacks.plist README.txt uninstall.sh*
NSFontFallbacks.plist install.sh*
재부팅
나눔폰트 적용 확인 예) 설치시 비밀번호 입력 창
iOSDev, UIImage, 이미지 자르기에서 고려할 점. (Crop images)
이 글을 쓰게 된 이유를 적어 본다.
경우는 2가지가 있는데…
100개의 이모티콘을 프로그램에 적용할 시
경우1)
100개의 png 파일을 만들 수 있다.
경우2)
또는 1개 큰 타일 png(10×10)를 만들 수 있다.
(경우2의 적용과 더블어 XML 파서를 없앤 것으로 2초 가까이 성능향상이 있었다.)
여기서 문제점만 얘기를 하면,
경우1) 100개의 png
100개의 이미지는 file open을 100번 해야 한다. 이모티콘이 많아지면 더 문제로 느끼게 될 것이다.
경우2) 1개의 png
1개의 압축된 png 파일에서 100개의 이미지를 조각조각을 가지고 와서 화면에 뿌려줘야 한다.
이때 내가 profiling 하면서 체험 한 것은 CPU도 최대로 먹고, 시간이 오래 걸린다.
이유는 명확하지 못하나
우선 inflate(반대는 deflate) 에서 많은 시간을 잡아먹으므로 압축과 관련 있어 보인다.
압축풀기 혹은 이미지 색 인덱스, 파레트(palette)에서 많은 시간을 잡아 먹는 듯 싶다.
예를들어 파레트를 추측해 보면,
1개의 이미지파일에서 다양한 색의 인덱스 부분을 메타정보에 가지고 있을 것 같다.
이것을 이용해서 조각난 부분의 색을 표현하고 하는데 시간이 오래걸리는 것이다.
증상은 이모티콘 입력창이 느리게 뜬다. 미리 이미지를 조각내서 메모리에 들고 있었어도
결국 화면에 보여지는 부분에서 내부적으로 많은 일을 하다가 이모티콘 창이 늦게 뜬다.
결론,
우선 해결 하고 이글을 쓰게 되었는데…
해결은 큰 이미지를 우선 inflate을 먼저 한다.
방법은 아래 링크에 설명이 되있다.
출처 : Does CGContextDrawImage decompress PNG on the fly?
CGImageRef Inflate(CGImageRef compressedImage)
{
size_t width = CGImageGetWidth(compressedImage);
size_t height = CGImageGetHeight(compressedImage);
CGContextRef context = CGBitmapContextCreate(
NULL,
width,
height,
CGImageGetBitsPerComponent(compressedImage),
CGImageGetBytesPerRow(compressedImage),
CGImageGetColorSpace(compressedImage),
CGImageGetBitmapInfo(compressedImage)
);
CGContextDrawImage(context, CGRectMake(0, 0, width, height), compressedImage);
CGImageRef result = CGBitmapContextCreateImage(context);
CFRelease(context);
return result;
}
1) 큰이미지 inflate 시간
큰 이미지를 inflate 하는 시간은 그리 오래 걸리지 않았다.
2) 100개의 UIImage 화면에 뿌리는 시간 (이모티콘 입력창 보이는 시간)
이후 이미지를 100개 쪼개서 UIImage 에 넣어 두고
나중에 이 UIImage를 화면에 뿌려보니 빠르게 뜨는것을 볼 수 있었다.
svnX(OSX), merge 툴로 kdiff3 사용하기.
맥(OS X 10.6)에서 Subversion을 사용하면서
맥용 Merge 툴을 찾게 되었다.
kdiff3
잘 만들어진 Merge 툴 중 kdiff3가 나는 쓰기 편하다.
3way-merge 도 맘에 들고…
kdiff3 : http://kdiff3.sourceforge.net/
svnX
많은 소스를 버전 관리 하기 위해서는 터미널 코멘드로는
좀 어렵게 느껴지는 부분이 있다.
한꺼번에 비교를 하거나, 자동적으로 해줬으면 하는 부분 등등.
어쨌든 GUI용 Subversion 클라이언트로
내가 선택한 것은 svnX 이다.
svnX : http://code.google.com/p/svnx
svnX에서 kdiff3 를 호출해서 diff 또는 merge를 할 때 버그가 있다.
svnX 1.3.1버전은 뜨기는 하나 파일을 못 불러오는 버그가 있고,
svnX 버전관리 2011년 11월 30일 버전은 아예 kdiff3가 뜨지를 않는다.
이에 프로젝트 싸이트에 버그레포팅을 했고,
오늘 아침(12월 1일) 답변을 받았다.
해결방법 1)
“svnX – help의 3.11 Diff” 에 설명이 되있다.
3.11. Diff
In a working copy window, click the Diff icon to compare the selected items with their pristine copies (BASE revisions).
Click while pressing the shift key to compare the selected items with their previous (PREV) revisions.
Clicking while pressing the alt key displays a sheet that allows you to compare any two revisions of a single item.
In the general preferences, you can choose between:
FileMerge (requires Xcode installation or, at least, /usr/bin/opendiff & FileMerge.app)
TextWrangler (requires /usr/bin/twdiff)
BBEdit (requires /usr/bin/bbdiff)
CodeWarrior
Araxis Merge (requires /usr/local/bin/araxissvndiff)
DiffMerge (requires /usr/local/bin/diffmerge.sh)
Changes (requires /usr/bin/chdiff)
Guiffy (requires /usr/local/bin/guiffy)
KDiff3 (requires a symbolic link in ~/bin to the app’s binary:
execute `cd ~/bin; ln -s/Contents/MacOS/kdiff3`).
※ 관련 내가 이전에 쓴글 : svnX for Mac OS X 에서 KDiff3 사용하기.
해결방법 2)
이건 버그레포팅에서 내가 제시했던 것.
주의할 것은,
답변으로 OS X 10.5 (이하?) 버전 에서는 “--args” 옵션이 안된다고 한다.
/Applications/svnX.app/Contents/Resources/svndiff.sh
- “kdiff3″ ) ~/bin/kdiff3 “$file1″ “$file2″ &> /dev/null ;;
+ “kdiff3″ ) open -a kdiff3 --args “$file1″ “$file2″ &> /dev/null ;;
간단하다.
다음은 버그레포팅 내용이다.
http://code.google.com/p/svnx/issues/detail?id=151
Reported by dh.j…@gmail.com, Today (14 hours ago)
What steps will reproduce the problem?
What is the expected output? What do you see instead?>> kdiff3 is not open problem.
What version of the product are you using? On what operating system?
>> OS : Mac( OS X 10.6.x )
>> svnX Version : subversion repository version & 1.3.1Please provide any additional information below.
>> look below a patch.
>> and please apply them.![]()
@@ -65,7 +67,7 @@
“changes” ) /usr/bin/chdiff “$file1″ “$file2″ ;;
“guiffy” ) DIFF=’/usr/local/bin/guiffy’; if [ $isWorkingCopy ]
then “$DIFF” -m “$file1″ “$file2″ “$file2″; else “$DIFF” “$file1″ “$file2″; fi ;;
- “kdiff3″ ) ~/bin/kdiff3 “$file1″ “$file2″ &> /dev/null ;;
+ “kdiff3″ ) open -a kdiff3 --args “$file1″ “$file2″ &> /dev/null ;;
“filemerge” | * ) DIFF=’/usr/bin/opendiff’; if [ ! -x "$DIFF" ]; then DIFF=”/Developer$DIFF”
if [ ! -x "$DIFF" ]; then DIFF=’opendiff’; fi; fi
if [ $isWorkingCopy ]; then “$DIFF” “$file1″ “$file2″ -merge “$file2″ &> /dev/nullComment 1 by project member chr…@lavabit.com, Today (8 hours ago)
Please open svnX’s Help window & read section “3.11. Diff”.The `open` command does not accept `--args` on OSX 10.5, so your patch won’t work there.
Delete comment Comment 2 by dh.j…@gmail.com, Today (20 minutes ago)
Ok. thanks to rapidly reply.
- 끝 -
iOSdev, PNG 최적화 스크립트.( pngcrush + advpngidat )
1. 참고 링크
2. pngcrush, advpngidat 사용법
- pngcrush (extreme)
$ pngcrush -fix -iphone -brute hello_world.png ./Resources/hello_world.png
- advpngidat
$ advpngidat -z4f Resources/hello_world.png
3. 스크립트
Xcode-OptimizePNG 를 참고해서 만든 PNG를 Extreme 최적화 시키는 스크립트입니다.
- 최적화 스크립트 : optpng.sh
※ 참고 : 첨부파일 확장자 제한으로 확장자 odt를 붙임. - 사용법 :
~/bin $ ./optpng.sh
Usage :
./optpng.sh [*.png|filename.png]
OSX, Auto Mute, 무음 단축키, Mute shortcuts
현재 Snow Leopard 사용중이다.
OSX에서 소리관련(특히 무음) 단축키를 찾아봤지만, Snow Leopard에는 없는 것 같다.
그래서 무료 소프트웨어 프로그램을 찾게 되었는데… 괜찮은게 있어서 공유한다.
URL : http://auto-mute.com/ (Open new window)
설정 메뉴를 살펴보면,
- OSX 시작시 Auto Mute 를 자동으로 시작 할건지?
- 로그오프, 서스펜드, 셧다운에서 Mute를 할것인지?
- 스크린세이버 에서 Mute 할것인지?
- Mute on 또는 off 단축키 지정
- Mute off 할 때 시스템 비프음을 들리게 할것인지?
를 설정할 수 있다.
iPod Touch 2G, iOS 4.2.1 메모리 확보. (Enable of Swap Memory.)
권하지 않음… daemon 내리고 원복했습니다.
수시로 멈추고 홈 + 전원으로 리셋도 잘 안되기도 하네요.
Read the rest of this entry »
Xcode, .h, .m 분할(split) 해서 같이 보기.
사실 이 섹션의 제목은 ”Find and Display Related Content” 이다.
관련된 것을 찾아서 보여주는 것인데…
.h 와 .m이 서로 많이 쓰이고 전달이 쉬울 것 같아서 이렇게 제목을 붙였다.
1. The Assistant button

누르면 분할 화면으로 .h 에 매칭되는 .m 파일이 열린다. (혹은 반대로…)

2. 레이아웃 변경. 가로분할, 세로분할 설정을 할 수 있음.
Menu 에서
View > Assistant Layout

- 끝 -
















Xcode4, “code snippets” 기능으로 Doxygen 주석 쉽게 달기.
leave a comment »
참고 : Easy Doxygen code snippets for Xcode 4
1. Xcode 에디터에 붙여넣기
다음을 Xcode 에디터에 붙여넣기 한다.
/**
<#description#>
@param <#parameter#>
@returns <#retval#>
@exception <#throws#>
*/
2. Xcode4 의 “Code Snippets Library” 찾기.
오른쪽 프로퍼티 부분 아래쪽에 “Code Snippets Library”가 있는데 두번째 탭 버튼이 “{}” 이다.
“{}” 탭은 콤보로 되있는데 “User” 를 선택하고,
3. Code Snippets 새로 생성하기.
Xcode에디터에서 1번에서 붙여넣기 했던 코드를 Drag & Drop 으로 User 영역에 가지고 온다.
그러면 새로운 Code Snippets 이 생긴다.
새로 생성되면 “Edit” 화면이 된다.
내가 입력한 예를적어보면,
Title : Method Comments
Platform : All
Completion Shortcut : doc
Completion Scopes : All
4. 수정 완료
“Done” 버튼을 누르면 수정이 끝난다.
언제든지 “Edit” 버튼을 눌러서 수정이 가능하다.
5. 자동완성 (Auto Completion)
이제 자동완성이 켜져 있으면,
dox[Enter] ( or dox[Tab]) 으로
위 화면을 볼 수 있다.
※ 자동완성이 잘 안되면,
Drag & Drop 으로 할 수 있다.
“Code Snippets” 을 Xcode 에디터의 붙이고 싶은 곳으로
Drag & Drop으로 Doxygen 주석을 추가 할 수도 있다.
Share this:
lum7671 작성
2011/11/21 at 8:52 오후
Posted in iOS, iPhone, Programming, Xcode
Tagged with code snippets, Comments, completion, Doxygen, 자동완성, 주석, XCode, Xcode4