Skip to content
This repository has been archived by the owner on Feb 6, 2022. It is now read-only.

Font Rendering with @prefixed in front #84

Open
Denoder opened this issue Dec 31, 2016 · 6 comments
Open

Font Rendering with @prefixed in front #84

Denoder opened this issue Dec 31, 2016 · 6 comments

Comments

@Denoder
Copy link

Denoder commented Dec 31, 2016

There's a problem where fonts has @ in front of their names and doesnt get loaded

Example:

http://prntscr.com/dpx2ba

@Arnavion
Copy link
Owner

What exactly is the problem? Do you have an example page I can access?

@Denoder
Copy link
Author

Denoder commented Dec 31, 2016

I temporarily fixed it by doing this:

            Object.defineProperty(Style.prototype, "fontName", {
                /**
                 * The name of this style's font.
                 *
                 * @type {string}
                 */
                get: function () {
                    return this._fontName.replace('@','');
                },
                enumerable: true,
                configurable: true
            });

Basically, when its getting the FontName from the .ass file there are fonts with @ infront of the font name (like @arial) this would lead to naming the font-family css selector "with" the @ symbol in front of the name.

@Arnavion
Copy link
Owner

As far as I can tell every place that sets the font-family CSS property will quote the font name, so there shouldn't be a problem.

If your change makes it work, it sounds like even though the font file wants a font named @foo the actual font installed on your system is named foo. Is there some ASS feature that the @ in font names is supposed to be ignored?

@Arnavion
Copy link
Owner

Arnavion commented Dec 31, 2016

Okay, I see there is some special meaning to leading @ https://github.com/libass/libass/blob/8b898d6b/libass/ass_parse.c#L107

@Denoder
Copy link
Author

Denoder commented Dec 31, 2016

so do i just leave my change?

@Arnavion
Copy link
Owner

Arnavion commented Jan 3, 2017

What you have will work. I think a better place to strip the leading @ will be in SpanStyles when setting the CSS property (in case there is some reason to keep the @ around for something else), but the end result will be the same for now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants