'freetype'에 해당되는 글 3건

  1. 2010.05.30 libfreetype tutorial 따라하기 2
  2. 2010.05.30 libm (math library)
  3. 2010.05.26 libfreetype, FreeType project 4
libfreetype의 example1.c 컴파일 하려면 보기보다 빡시다
버그인지는 모르겠지만 /usr/include/ft2build.h 파일에 include 경로가
 #include <freetype/config/ftheader.h>
로 되어있지만 실제로 이 경로는 존재하지 않는다.

/usr/include/freetype2/freetype 에 각종 헤더들이 존재하는데, 이를 해결하기 위해서는
 ln -s /usr/include/freetype2/freetype /usr/include/freetype
이런식으로 심볼릭 링크를 생성해주어야 한다.

아무튼 이러한 헤더경로를 수정해주고 나면 모르면 어려운 에러가 발생한다.
freetype 을 사용하는 녀석들은 수학 라이브러리와 freetype 라이브러리를 사용하므로
 $ gcc -lm -lfreetype
을 넣고 컴파일을 돌려야 한다.
2010/05/30 - [Linux] - libm (math library)

그리고 example1.c 의 경우 폰트의 경로를 직접넣어 주어야 한다.
우분투에서 폰트의 기본 경로는 /usr/share/fonts 이므로 그 안에서 직접 폰트의 전체경로를 넣어주어야 한다.
2010/05/30 - [Linux/Ubuntu] - 우분투 기본 폰트 경로 - Default path of Ubuntu fonts

freetype-doc-2.3.12.tar.bz2 << 이녀석을 압축해제하면 docs/tutorial 에 example?.c 파일'들'이 있다.
그중에 example1.c 를 컴파일 하였으며
 $ gcc -lm -lfreetype example1.c
 $ ./a.out /usr/share/fonts/truetype/ttf-japanese-gothic.ttf test > tt.txt
위와 같은 명령줄로 실행하여 나온 결과는 아래와 같다.
이미지 처럼 나온 것은 메모장을 축소하여 일부분만 잘라낸 것이다.



Posted by 구차니
Linux2010. 5. 30. 19:00
libfreetype 테스트용 프로그램을 컴파일 하는데
아래와 같은 문제가 발생을 했다.

$ gcc example1.c -lfreetype
/tmp/cc2ePnil.o: In function `main':
example1.c:(.text+0x278): undefined reference to `cos'
example1.c:(.text+0x2b0): undefined reference to `sin'
example1.c:(.text+0x2e8): undefined reference to `sin'
example1.c:(.text+0x320): undefined reference to `cos'
collect2: ld returned 1 exit status

해결책은 간단하게 gcc -lm 을 하면 되는데,
Perhaps it needs the maths library linked, -lm, as that is where 'cos' will be.
Though that seems a strange thing to be missing.

[링크 : http://computer-yocher.blogspot.com/2010/05/re-sage-devel-sage-441-build-failures.html]

여기서 -l 은 library이고 파일명으로는, lib 접두가 붙게된다.
즉, -lm은 우분투 10.04 기준으로
lrwxrwxrwx 1 root root      14 2010-05-26 21:55 /usr/lib/libm.so -> /lib/libm.so.6

이녀석을 의미하고, cos() sin() tan()을 사용하는 math.h 를 사용할때에는
추가적으로 -lm 옵션을 추가하여 math library를 링크해주어야 한다.

Posted by 구차니

[공식 : http://www.freetype.org/]
    [freetype 1 : http://freetype.sourceforge.net/freetype1/index.html] << freetype 2로 프로젝트 넘어감
    [freetype 2 : http://freetype.sourceforge.net/freetype2/index.html]


libfreetype은 freetype 프로젝트의 부산물(?)이며, 이녀석은 글꼴을 그려주는 라이브러리이다.
  • By default, FreeType 2 supports the following font formats.

    • TrueType fonts (and collections)
    • Type 1 fonts
    • CID-keyed Type 1 fonts
    • CFF fonts
    • OpenType fonts (both TrueType and CFF variants)
    • SFNT-based bitmap fonts
    • X11 PCF fonts
    • Windows FNT fonts
    • BDF fonts (including anti-aliased ones)
    • PFR fonts
    • Type 42 fonts (limited support)
보다시피 거의 모든 폰트를 지원하며, 벡터/TrueType 폰트/외곽선 폰트 및 비트맵 폰트를 지원한다.
말이 복잡하지만, 간단하게 말해서 확대해도 안깨지는 글꼴과 확대하면 깨지는 글꼴을 지원한다.

그리고 두가지 라이센스를 제공한다. 머 BSD-like 가 GPL보다는 숨통이 트이니 사용자 입장에서는 좋긴하다.
FreeType 2 is released under two open-source licenses: our own BSD-like FreeType License and the GPL.


아무튼, 애플에서 이러한 힌팅기술에 대한 특허를 가지고 있으므로
특허권에 의해서 patented bytecode를 무시하여 약간은 부드럽지 못하게 나온다고 한다.
(아래의 사진을 보면 K R W Z 가 약간 깨어져 보인다.)
What Is Patented

It is important to clarify that the patents only cover a small subset of the TrueType instructions (not the whole process of hinting glyphs with specific bytecode programs). Unfortunately, the patented bytecodes are relatively often used in high-quality glyph programs.

For example, here is a picture showing the ‘Arial’ font with a specific version of the FreeType bytecode interpreter that simply ignores the patented bytecodes.

As you can see, some rather unpleasant artifacts make the font unacceptable for normal reading use.

Is FreeType 2 Affected by the Patents?

The answer is no for any recent build of FreeType 2, since it comes with an ‘auto-hinting’ module that was specifically designed to completely ignore the TrueType bytecode instructions.

However, the source code for the bytecode interpreter is still available and can be toggled on at compile time, for those that want to use it anyway (because they purchased a license from Apple, or because they are in a country where the patents do not apply, etc.). For details please check the documentation that comes with your FreeType source package (it normally involves changing one configuration macro).

Note that some beta versions of FreeType 2 did use the bytecode interpreter (since the auto-hinter wasn't available yet).

Finally, many Linux distributions seem to distribute a patched version of FreeType 2 with the bytecode interpreter activated, unlike the sources we distribute. Of course, we can only deny any kind of responsibility in this case. It further means that in the event where you need to update the version of FreeType installed on your system from our sources, you should better manually activate the bytecode interpreter at compile time in order to prevent any loss of quality.

[링크 : http://freetype.sourceforge.net/patents.html]


트루타입(TrueType)은 외곽선 글꼴 표준으로, 1980년대 말에 애플 컴퓨터어도비포스트스크립트에 쓰이는 타입 1 글꼴에 대항하기 위해 개발하였다. 트루타입의 주된 이점은 글꼴 개발자들에게 글꼴이 다양한 글꼴 크기에서 어떻게 표시될 것인지에 대한 높은 수준의 제어를 할 수 있다는 것이며 이를 힌팅기술 혹은 힌팅 인스트럭션이라고 한다.

[링크 : http://ko.wikipedia.org /wiki/트루타입]
[링크 : http://en.wikipedia.org/wiki/TrueType]

Posted by 구차니