Skip to content

freetype2: Fix comments in freetype.hpp and README.md #2776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions modules/freetype/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
FreeType Module
===========
FreeType2 Wrapper Module
========================

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

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

Installation
-----------
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/
- harfbuzz https://www.freedesktop.org/wiki/Software/HarfBuzz/
- freetype https://www.freetype.org/

Usage
-----------
cv::freetype::FreeType2 ft2;
ft2.loadFontData("your-font.ttf", 0);
ft2.setSplitNumber( 4 ); // Bezier-line is splited by 4 segment.
ft2.putText(src, .... )
-----

```
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.

Future work
------------
- test
-- CJK and ...
- RTL,LTR,TTB,BTT...
- 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.
2 changes: 1 addition & 1 deletion modules/freetype/include/opencv2/freetype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If you want to draw small glyph, small is better.

The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.

@param img Image.
@param img Image. (Only 8UC3 image is supported.)
@param text Text string to be drawn.
@param org Bottom-left/Top-left corner of the text string in the image.
@param fontHeight Drawing font size by pixel unit.
Expand Down