Skip to content
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

Cannot find correct font resource in makeText (OCP branch) #337

Closed
michaelgale opened this issue May 1, 2020 · 6 comments
Closed

Cannot find correct font resource in makeText (OCP branch) #337

michaelgale opened this issue May 1, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@michaelgale
Copy link

When attempting to specify a specific typeface for makeText, it results in the following error:

Font_FontMgr, warning: unable to find font '/usr/share/fonts/truetype/DIN/DIN-Regular.ttf' [regular]; 'FreeSans' [aspects: regular,bold,italic,bold-italic] [paths: /usr/share/fonts/truetype/freefont/FreeSans.ttf;/usr/share/fonts/truetype/freefont/FreeSansBold.ttf;/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf;/usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf] is used instead

After making an alternate implementation of makeText, I discovered that the makeText method should be modified as follows:

        text_flat = Shape(
            builder.Perform(font.FontPath(font_kind).ToCString(), size, font_kind, text)
        )

should be:

        text_flat = Shape(
            builder.Perform(font.FontName().ToCString(), size, font_kind, text)
        )

Perhaps its related to how Font_BRepTextBuilder gets wrapped when building OCP?

Tested on Linux version 4.15.0-96-generic (ubuntu 18.04)

@jmwright
Copy link
Member

jmwright commented May 1, 2020

I get the same error on Ubuntu 18.04.

@michaelgale
Copy link
Author

@jmwright Glad to hear its repeatable. After changing the way Font_BRepTextBuilder gets called, I can use any font (although not all Font Aspects) discovered by OCCT from the OS's font libraries. I can also register new fonts (or modify mappings inside the OCCT internal font library) to fine tune the selection of desired typefaces. I think the problem is related to how the arguments to Font_BRepTextBuilder.Perform get mapped from OCCT to OCP.

@adam-urbanczyk adam-urbanczyk added the bug Something isn't working label May 2, 2020
@adam-urbanczyk
Copy link
Member

Thanks for finding this @michaelgale !

adam-urbanczyk added a commit that referenced this issue May 2, 2020
@jmwright
Copy link
Member

jmwright commented Feb 3, 2021

So was this fixed in this commit? 23418b9

@jmwright
Copy link
Member

This seems to be fixed. Closing.

@michaelgale
Copy link
Author

Yep. Its been fixed for a while. Forgot to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants