Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add tests for most of FT2Font, and fix some bugs#28765

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 11 commits intomatplotlib:mainfromQuLogic:ft2font-tests
Sep 6, 2024

Conversation

QuLogic
Copy link
Member

PR summary

I tried to cross-compare these against something external, like FontForge orfonttools, though a lot are just "make sure it keeps working the same way".

I left outFT2Font.get_ps_font_info because it doesn't appear that any of shipped fonts would return anything butNone.

Additionally, this fixes a few bugs I've found:

  • The return value ofFT2Font.set_text is a NumPy array with a data pointer that was freed, meaning any reading of it would read an invalid pointer. Apparently, we never use this return value internally, so it's never been a problem, but it has existed since about forever.
  • The created/modified timestamps in thehead table fromFT2Font.get_sfnt_table were signed, which is incorrect, as they should still be positive now, given that the epoch is some time in 1901. I'm not sure if we want to consider changing these todatetimes instead, but that would be an API change, so I didn't do that.
  • Fix a few errors in the docs.

I want to also add some more tests for fallbacks, but haven't finished that yet.

PR checklist

The only externally-available API here is `draw_rect_filled` andconversion to NumPy arrays via the buffer protocol.
Also, ensure some internals are initialized/cleared.
Also, correct the reading of creation and modified dates.
`PyArray_SimpleNewFromData` does not copy its input data, and the`std::vector` is a local variable that disappears after the C++ methodreturns.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestSep 6, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to587, which triggers some code paths for tables that are limited to 256characters.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestSep 6, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
@QuLogicQuLogic mentioned this pull requestSep 6, 2024
1 task
@tacaswelltacaswell added this to thev3.10.0 milestoneSep 6, 2024
@tacaswelltacaswell merged commitcb9cf3b intomatplotlib:mainSep 6, 2024
48 checks passed
@QuLogicQuLogic deleted the ft2font-tests branchSeptember 6, 2024 01:55
@tacaswell
Copy link
Member

It looks like this PR is causing the code in5f2a89a to fail to compile on the older OSX targets we use with errors that look like

        FAILED: src/ft2font.cpython-313-darwin.so.p/ft2font.cpp.o451        c++ -Isrc/ft2font.cpython-313-darwin.so.p -Isrc -I../src -I../subprojects/freetype-2.6.1/include -I../../../pip-build-env-4ch2e0bi/overlay/lib/python3.13/site-packages/numpy/_core/include -I../extern/agg24-svn/include -I/Library/Frameworks/Python.framework/Versions/3.13/include/python3.13 -fvisibility=hidden -fvisibility-inlines-hidden -flto -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c++17 -O3 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ft2font_ARRAY_API '-DFREETYPE_BUILD_TYPE="local"' -MD -MQ src/ft2font.cpython-313-darwin.so.p/ft2font.cpp.o -MF src/ft2font.cpython-313-darwin.so.p/ft2font.cpp.o.d -o src/ft2font.cpython-313-darwin.so.p/ft2font.cpp.o -c ../src/ft2font.cpp452        ../src/ft2font.cpp:731:14: error: 'to_chars<unsigned int, 0>' is unavailable: introduced in macOS 10.15453                std::to_chars(buffer.data() + 3, buffer.data() + buffer.size(),454                     ^455        /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/charconv:458:1: note: 'to_chars<unsigned int, 0>' has been explicitly marked unavailable here456        to_chars(char* __first, char* __last, _Tp __value, int __base)457        ^

@QuLogic
Copy link
MemberAuthor

No, that's been failing since it was merged; it's not related to this PR specifically.

tacaswell reacted with thumbs up emoji

QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestOct 16, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 3, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 11, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 18, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
QuLogic added a commit to QuLogic/matplotlib that referenced this pull requestDec 19, 2024
Working onmatplotlib#28765, I realized that we don't need an external font totest font fallback, as `cmr10`, and related, fonts have fairly lowcoverage compared to `DejaVu Sans`. Thus font fallback can easily betested by starting with `cmr10`, and pulling additional characters from`DejaVu Sans`.In addition, this change increases unique characters in the figure to491, which triggers some code paths for tables that are normally limitedto 256 characters.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@oscargusoscargusoscargus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.10.0
Development

Successfully merging this pull request may close these issues.

3 participants
@QuLogic@tacaswell@oscargus

[8]ページ先頭

©2009-2025 Movatter.jp