rougier / freetype-py

Python binding for the freetype library
Other
298 stars 88 forks source link

Documentation for get_first_char #156

Closed Yardie- closed 1 year ago

Yardie- commented 1 year ago

In the documentation for get_first_char it states

        This function is used to return the first character code in the current
        charmap of a given face. It also returns the corresponding glyph index.

        :return: Glyph index of first character code. 0 if charmap is empty.

        **Note**:

          You should use this function with get_next_char to be able to parse
          all character codes available in a given charmap. The code should look
          like this:

          Note that 'agindex' is set to 0 if the charmap is empty. The result
          itself can be 0 in two cases: if the charmap is empty or if the value 0
          is the first valid character code.

There is no example.

HinTak commented 1 year ago

There is. Look at ftdump.py in the examples directory.

Yardie- commented 1 year ago

You didn't even read the issue then you close it.

That is not what the documentation says it references it in get_next_char as

You should use this function with FT_Get_First_Char to walk over all character codes available in a given charmap. See the note for this function for a simple code example.

As I said before in get_first_char it specifically says.

The code should look like this: Then nothing

So you think it's reasonable that someone searches through 700K in 39 files for three lines of code rather than fixing the documentation. That's rather strange

HinTak commented 1 year ago

This is an open-source project, worked on by volunteers. If you think the documentation is incomplete/wrong, please feel free to improve it with a pull.

I assume that paragraph was copied from upstream (ie freetype) with the c code inline snipplet deleted. That said, your basic assertion was incorrect - there is an example, and in quite an obvious place too. Besides, you can do search on github's project page on a per repo basis, which would locate it immediately.