-
Notifications
You must be signed in to change notification settings - Fork 29
font size changed in libjass #55
Comments
For the browser to show the font you need to have a CSS
I will test this. But just to confirm, both images are for the same script you put at the end? So did the font change during playback from the wrong one to the right one, which is how you got two different screenshots for the same script (one with wrong font, one with wrong size)? |
first, thank you for replyy 👍 ) "it looks like font problem solved or something like this hhhhhhhh" |
If libjass uses the wrong font then it is quite possible the resulting size will be wrong. On my machine I used the script from your OP and got almost the same size as in your libass image (it was slightly smaller than libass, but not so much smaller like in your libjass image). Can you confirm that the size is correct after you add the |
hi all |
It is not a commonly used feature, so no. Not yet, atleast. I can imagine the only way to get the browser to use it would be to generate a |
hello arnavion |
You need to pass in that parameter in renderer settings when you create the renderer, otherwise it will not know which fonts to preload. http://arnavion.github.io/libjass/api.xhtml#libjass.renderers.RendererSettings.fontMap |
Hii , Can u Give us a Simple Example Plz :) |
I guess I should clarify the docs a bit more.
|
thank u for the tutorial arnavion-kun |
Thank u ArnaVion 👍 |
I can reproduce it for the second case (the one using Hacen Typographer). The issue is that when libjass wants to measure the font metrics by setting the font-measure div to "Hacen_Typographer" font family, the browser renders it as Arial first and then later renders as Hacen Typographer. So the font metric becomes wrong because it calculates the metric for Arial. |
It doesn't have anything to do with the fact that Hacen Typographer is loaded via XHR, since the metric is calculated when the clock starts ticking, which for DefaultRenderer is after it has preloaded the fonts. To be absolutely sure, I added a delay of 1s between finishing preloading fonts and starting the clock, and the issue still repros. It might be that browsers (or atleast Chrome anyway) apply local font families in the first tick and then update them to use custom
|
so from what i understand from ur explain that there is no solution for the right time ?? |
The sync method of setting the fontSize div to the requested font family and measuring its offsetHeight doesn't work when the request font family is from a @font-face declaration. Atleast some browsers render the div with text in a locally installed fallback font and update it to the actual font in a future tick. For example, if the metrics are being calculated for `Foo, Arial, Helvetica, sans-serif, 'Segoe UI Symbol'` where Foo is defined via a `@font-face` declaration, then the M glyph is rendered in Arial for that tick, and updated to Foo in a future tick. This change adds a delay between setting the font on the div and measuring its offsetHeight, which requires making the metric calculation async. Since the renderer pipeline cannot be made async, this change also causes the font metric to be computed while the font is being preloaded, since preloading is already an async operation. The original sync method still remains to be able to calculate metrics for non-preloaded fonts; a note has been added that this will result in wrong sizes for these fonts unless they're already installed on the user's machine. Reported in #55
but we don't understand what to do exactly?? or how to apply your solution? |
git clone https://github.com/Arnavion/libjass
cd libjass/
npm install Now use |
ok, we'll try then tell u |
@ken-lofi Did you try it? |
Hi guys, I'm facing the same problem about font size. |
I explained in #55 (comment) What specifically did you not understand? |
I need to preload font for make the font appear at the right size, right? So which file should I edit for add this: |
The same place where you are currently using libjass.renderers.DefaultRenderer - your website's JS file. |
I'm using v 0.10.0 downloaded here: https://github.com/Arnavion/libjass/releases |
libjass is a library. You have to include it on your web page and then write your own JS to use it. For example look at the demo page. It includes libjass.js and its own index.js, and index.js contains the code to use libjass to show subtitles. |
In my site I'm going to use videojs-ass. There is: But there isn't libjass.renderers.DefaultRenderer. |
videojs-ass uses WebRenderer which is fine - the fontMap property is for both WebRenderer and DefaultRenderer. It lets you give options so that is where you would expect to be able to set the fontMap property, but videojs-ass only uses the enableSvg property from the options. You should file an issue there. |
SunnyLi have fixed the problem, but still the font is too big. But this is how I see the font on my PC Desktop. There is a big difference. I also included the font using @font-face, but nothing. I have also installed this font on my Windows, but it shouldn't be a problem. Any help? |
Give me the script and the font. |
Also, try replacing videojs-ass's copy of libjass.js with the one from https://raw.githubusercontent.com/Arnavion/libjass/gh-pages/demo/libjass.js and see if it makes a difference. That is from v0.11.0 that contains some font size fixes. |
Using v0.11.0 I don't see any difference.... Please tell me how can I send to you the script and the font in private |
Join #libjass on Rizon and PM me |
It says this: [14:28] == #libjass Cannot join channel (+b) |
Heh, apparently Rizon auto-banned all of Italy from every channel I'm in last year.
Unbanned now. |
Do you have a URL to your site where I can see how you're using it? Since your video resolution and script resolution are different ratios (1.78 vs 1.5) I suspect there is some bug related to that on your site. |
I fixed the problem on font-face but still the font is big...
Also, in this image subtitle is rendered in 3 lines. In aegisub is rendered in just 2 lines. But this is due the big size of the font, I think. |
I uploaded everything from my localhost to a testing site. You can find everything here: http://test995.altervista.org/index.php/player/8/8 Even here the font is big. |
For the margin problem - libjass's letterboxing calculation was wrong. See #62 That is why your 1.5:1 script was not stretching to the full width of a 1.78:1 video and giving the appearance of having too much horizontal margin. |
The source of my script is 720x480, but also the video source I used was 720x480... |
No, the video on your site is 720x408 and target resolution is 850x482 |
The video I put on the testing site yes, is 720x408 |
It looks 852x480 to me. Anyway that example shows in two lines for me with the fix in #62 for both 852x480 video and 720x480 video, as it should. Now you just have to wait for SunnyLi to update videojs-ass to use it. |
Thank you very much. I used the code you posted there and replaced with the old code and now works perfect, even the line of the previous screen now is in 2 lines. Thank you very much! |
Sorry, another question. Now I'm using the script you gave to me: https://raw.githubusercontent.com/Arnavion/libjass/gh-pages/demo/libjass.js Anyway, should I also use the new css: https://raw.githubusercontent.com/Arnavion/libjass/gh-pages/demo/libjass.css ? |
Yes you should use the updated styles. FYI, I've updated the videojs plugin to work with the latest dev version. |
In PC desktop everything works great, but there is a very critical problem on mobile device. So there is just 1 line but is impossible to read since there are 2. Please take a look at the screen, this show there is no margin and the overlay of 2 line sub: http://s8.postimg.org/7wp24f5zo/Screenshot_2016_01_24_22_12_15.jpg |
Please open a new issue when your issue is not the same as the current one. |
hello
i have two problem after using libjass on website
the first is about support fonts
i think the pre-loading not work properly
i have all the font in my pc and also i have attached font to the script
but here photo of what appears
in libass
![23_001_2779](https://cloud.githubusercontent.com/assets/14111009/9661557/23f2add2-5253-11e5-81fa-30bb074cbd44.png)
http://im49.gulfup.com/8NvrgU.png
in libjass
![23_003_2779](https://cloud.githubusercontent.com/assets/14111009/9661571/313313e2-5253-11e5-8287-93f75d43947c.png)
http://im49.gulfup.com/Bp3V1O.png
the second problem with font size... sometimes become smaller and sometime bigger
here in libass
![23_001_2779](https://cloud.githubusercontent.com/assets/14111009/9661582/3d0d849a-5253-11e5-8b5e-4450e73f35fa.png)
http://im49.gulfup.com/8NvrgU.png
and here in libjass
![23_002_2779](https://cloud.githubusercontent.com/assets/14111009/9661600/4d921c22-5253-11e5-87b1-1f1efc860320.png)
http://im49.gulfup.com/Yn5u5K.png
The text was updated successfully, but these errors were encountered: