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

Fonts with same name same weight and same italic #8

Closed
asakurato opened this issue Dec 4, 2022 · 12 comments
Closed

Fonts with same name same weight and same italic #8

asakurato opened this issue Dec 4, 2022 · 12 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@asakurato
Copy link

So I have the following issue. I have a font named SF Pro Display, that has different weight (and italics) options in the same name (see attached screenshots)
image
image
In the ass file, I'm using the first one and Aegisub font collector does collect the first one (shown below). So for some reason, this tool collects the italic variant.
image

@moi15moi
Copy link
Owner

moi15moi commented Dec 4, 2022

I talked in pm with @asakurato.

Here is the subs and the font he provided me: Font _ Subs.zip

I will test and see what can cause this problem.

@moi15moi
Copy link
Owner

moi15moi commented Dec 4, 2022

@asakurato I tried with what you provided me.

Aegisub and FontCollector returned me the same font.
This means both of them returned me the font: SFProDisplay-BoldItalic.ttf

But, I installed SFProDisplay-Bold.ttf and windows does not list it in C:\Windows\Fonts. This is weird.

The font is maybe broken. I will try and see what cause this problem.

Also, you did not provide me all the font, so I got some error:

Updating font cache
Parsing file
Searching for font files
Found '@A-OTF Shin Maru Go Pro B' at 'C:\Windows\Fonts\A-OTF-ShinMGoPro-Bold - Copie.otf'
Could not find font 'Bliss Pro OT'
Used in styles:
  - phone 2

Found 'DFGKaiSho-UB' at 'C:\Windows\Fonts\dfkpo5.ttc'
Could not find font 'Dadhand'
Used on lines: 2341 2342

Could not find font 'Diavlo Bold'
Used in styles:
  - OP-Rom
  - OP-TL

Could not find font 'FC-Flower'
Used on lines: 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2733 2734 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2778 2795 2796 2797 2798 2799 2800 2801 2802 2803 2806 2817 2818 2819 2820 2821 3494 3495 3496 3497 3498 3499 3583 3584 3585 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605

Could not find font 'FOT Manyo Sosho Std Stripped EB'
Used in styles:
  - ED-Rom
  - ED-TL

Could not find font 'Falling Sky'
Used in styles:
  - Office

Found 'Gandhi Sans' at 'C:\Windows\Fonts\Gandhisans-Bold.otf'
'Gandhi Sans' does not have an italic variant.
Used in styles:
  - Default (Italic)
Used on lines: 2049 2173 2264 2321

Found 'Myriad Pro Light' at 'C:\Windows\Fonts\MyriadPro-Semibold.ttf'
'Myriad Pro Light' does not have a bold variant.
Used on lines: 2336 2338

Could not find font 'SF Compact Display'
Used in styles:
  - phone

Could not find font 'SF Compact Display'
Used on lines: 2333

Found 'SF Pro Display' at 'C:\Windows\Fonts\SFProDisplay-BoldItalic.ttf'
Done

8 fonts could not be found.
Copying fonts to folder...
* Copied C:\Windows\Fonts\A-OTF-ShinMGoPro-Bold - Copie.otf.
* Copied C:\Windows\Fonts\dfkpo5.ttc.
* Copied C:\Windows\Fonts\Gandhisans-Bold.otf.
* Copied C:\Windows\Fonts\MyriadPro-Semibold.ttf.
* Copied C:\Windows\Fonts\SFProDisplay-BoldItalic.ttf.
Done. All fonts copied.

@moi15moi
Copy link
Owner

moi15moi commented Dec 4, 2022

@asakurato From what I see here, Apple provide opentype font, not truetype font like you gave me.

With the opentype font, Aegisub and FontCollector (this tool) return me the font SF-Pro-Display-Bold.otf

@asakurato
Copy link
Author

Well, I didn't get it from apple website (and they are .dmg files), but the files I gave you were collected by Aegisub, so truetype or not, Aegisub did it correctly. The weird thing is, Fontcollector now also collects correct the Bold variant, without changing anything else.

@asakurato
Copy link
Author

Yeah, there's something weird going on. I tested it again and it have me Italic variant, again.

@asakurato
Copy link
Author

While doing the tests, I found another issue, where Fontcollector collects font under different name than Aegisub, which can potentially double fonts if the output folder is not empty.

@moi15moi
Copy link
Owner

moi15moi commented Dec 4, 2022

Well, I didn't get it from apple website (and they are .dmg files)

Dmg file can be extracted and you will see that apple provided opentype font.

but the files I gave you were collected by Aegisub, so truetype or not, Aegisub did it correctly. The weird thing is, Fontcollector now also collects correct the Bold variant, without changing anything else.

To collect the font in the system, FontCollector depend on matplotlib.
matplotlib looks into these directory: C:\Windows\Fonts and %userprofile%\AppData\Local\Microsoft\Windows\Fonts.

The problem seems to be from windows.

From what I can see, I can only install one of these, because if I install one of them, the other one will be ignored:
Ex1:

  1. Install SFProDisplay-Bold.ttf
  2. Install SFProDisplay-BoldItalic.ttf
  3. I can only see the font SFProDisplay-Bold.ttf in C:\Windows\Fonts

Ex2:

  1. Install SFProDisplay-BoldItalic.ttf
  2. Install SFProDisplay-Bold.ttf
  3. I can only see the font SFProDisplay-BoldItalic.ttf in C:\Windows\Fonts

So, could you check if you see the file SFProDisplay-Bold.ttf and SFProDisplay-BoldItalic.ttf?

While doing the tests, I found another issue, where Fontcollector collects font under different name than Aegisub, which can potentially double fonts if the output folder is not empty.

This is not an issue.

@asakurato
Copy link
Author

asakurato commented Dec 4, 2022

Italic variant doesn't show up in C:\Windows\Fonts, but when I try to install it, it says it's already installed. And even if I install it, it still doesn't show up there. But it's being collected from somewhere, rigth?
Edit: It doesn't show up in Windows Explorer, but it does show up in the app Freecommander
image

@moi15moi
Copy link
Owner

moi15moi commented Jan 3, 2023

I did some research about your font.

Why it happen?

Because of that, FontCollector think that both font are exactly the same. That's why it doesn't always return the same font.

Is there a way to solve this problem?

Even libass/vsfilter doesn't know that the font is italic. They won't always dislplay the same font.

Even Aegisub FontCollector doesn't always return the same font.
For example, if you install SFProDisplay-BoldItalic.ttf then SFProDisplay-Bold.ttf, aegisub will return you SFProDisplay-BoldItalic.ttf
But, if you install SFProDisplay-Bold.ttf then SFProDisplay-BoldItalic.ttf, aegisub will return you SFProDisplay-Bold.ttf

In brief, the font is so broken that for now, I can't see how I can find a solution to "correct" this behaviour.

@moi15moi moi15moi added the wontfix This will not be worked on label Jan 3, 2023
@moi15moi moi15moi changed the title Fonts with same name, but different weight. Fonts with same name same weight and same italic Jan 14, 2023
@moi15moi
Copy link
Owner

moi15moi commented Oct 10, 2023

I did more research about your fonts.
There is no direct way to know if VSFilter display SFProDisplay-Bold - Original.ttf or SFProDisplay-BoldItalic - Original.ttf
So, I created SFProDisplay-BoldItalic - Generated.ttf which is the same has SFProDisplay-BoldItalic - Original.ttf, but the char "A" is mapped to the glyph "B".
Here is my Test.zip

Install SFProDisplay-BoldItalic - Generated.ttf before SFProDisplay-Bold - Original.ttf (VSFilter)
image

Install SFProDisplay-Bold - Original.ttf before SFProDisplay-BoldItalic - Generated.ttf (VSFilter)
image

GDI doesn't recognize the font SFProDisplay-BoldItalic - Original.ttf as italic.
However, DirectWrite recognizes it as italic because the NameRecord nameid 17 is set to "Bold Italic" (which appears to match the explanation here)

However, our goal is to match GDI.
In brief, if two fonts have exactly the same score (the score is generated like this), we prioritize the older font over the newest one.

This feature will be available in FontCollector 3.0.0

Edit: I should also test if GDI priorize local font vs system font

@moi15moi moi15moi added good first issue Good for newcomers and removed wontfix This will not be worked on labels Oct 10, 2023
@moi15moi moi15moi added this to the 3.0.0 milestone Nov 2, 2023
@astiob
Copy link

astiob commented Mar 6, 2024

Not the first time Apple does this: libass/libass#525. If you can, do please verify this on the latest macOS and file a report with Apple. (If not, oh well.)

moi15moi added a commit that referenced this issue Apr 28, 2024
**Changes**
- Now, we distinct a font file from a font face.
There are now 2 kind of font face. "Variable" is for [variable font](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) and "Normal" for the rest.
- Know what is the language of a family name or a exact name
- From a FontFace, get the best name depending of the OS language via ``ABCFontFace.get_best_family_name``/``ABCFontFace.get_best_exact_name``. The user can also query a family name from a BCP47 tag via ``ABCFontFace.get_family_name_from_lang``/``ABCFontFace.get_exact_name_from_lang``
- Users can know implement their own ass document reader. They just need to extend the class ABCAssDocument
- Users can create their own strategy to find a font. They simply need to implement FontSelectionStrategy.
Also, the user can choose between 2 strategy (FontSelectionStrategyLibass and FontSelectionStrategyVSFilter)
- Know if a font is a font collection (TTC/OTC file)
- Know what is the font type (opentype/truetype)
- Create a FontCollection class. It has the same responsabilities has the old FontLoader. The new FontLoader now only load the font cache, load a batch of fonts and load the system fonts.
- Add ``need_faux_bold`` attribute to ``FontResult``
- Resolve the issue #8
moi15moi added a commit that referenced this issue Apr 28, 2024
**Changes**
- Now, we distinct a font file from a font face.
There are now 2 kind of font face. "Variable" is for [variable font](https://fonts.google.com/knowledge/introducing_type/introducing_variable_fonts) and "Normal" for the rest.
- Know what is the language of a family name or a exact name
- From a FontFace, get the best name depending of the OS language via ``ABCFontFace.get_best_family_name``/``ABCFontFace.get_best_exact_name``. The user can also query a family name from a BCP47 tag via ``ABCFontFace.get_family_name_from_lang``/``ABCFontFace.get_exact_name_from_lang``
- Users can know implement their own ass document reader. They just need to extend the class ABCAssDocument
- Users can create their own strategy to find a font. They simply need to implement FontSelectionStrategy.
Also, the user can choose between 2 strategy (FontSelectionStrategyLibass and FontSelectionStrategyVSFilter)
- Know if a font is a font collection (TTC/OTC file)
- Know what is the font type (opentype/truetype)
- Create a FontCollection class. It has the same responsabilities has the old FontLoader. The new FontLoader now only load the font cache, load a batch of fonts and load the system fonts.
- Add ``need_faux_bold`` attribute to ``FontResult``
- Resolve the issue #8
@moi15moi
Copy link
Owner

Resolved in #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants