File: README.md

package info (click to toggle)
opencv 4.5.1%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 268,248 kB
  • sloc: cpp: 969,170; xml: 682,525; python: 36,732; lisp: 30,170; java: 25,155; ansic: 7,927; javascript: 5,643; objc: 2,041; sh: 935; cs: 601; perl: 494; makefile: 145
file content (34 lines) | stat: -rw-r--r-- 1,026 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FreeType2 Wrapper Module
========================

This FreeType2 wrapper module allows to draw strings with outlines and bitmaps.

Requested external libraries
----------------------------

harfbuzz is requested to convert UTF8 to gid(GlyphID).

freetype library is requested to rasterize given gid.

- harfbuzz https://www.freedesktop.org/wiki/Software/HarfBuzz/
- freetype https://www.freetype.org/

Usage
-----

```
cv::Ptr<cv::freetype::FreeType2> ft2;
ft2 = cv::freetype::createFreeType2();
ft2->loadFontData(ttf_pathname, 0);
ft2->putText(mat, "hello world", cv::Point(20, 200),
             30, CV_RGB(0, 0, 0), cv::FILLED, cv::LINE_AA, true);
```

Option
------
- 2nd argument of loadFontData is used if font file has many font data.
- 3 drawing mode is available.
    - outline mode is used if lineWidth is larger than 0. (like original putText)
    - bitmap  mode is used if lineWidth is less than 0.
        - 1bit bitmap mode is used if lineStyle is 4 or 8.
        - gray bitmap mode is used if lineStyle is 16.