GithubHelp home page GithubHelp logo

Comments (7)

mattjuggins avatar mattjuggins commented on July 3, 2024 1

My test case was using something along the lines of tts:fontFamily="myCustomFont, Arial, Helvetica, default". So default was used as a fallback rather than a single entry.

With the above in mind, I think there might be a problem similar to #245
default doesn't get converted to monospaceSerif correctly with the space character at the start when the array is split. It could be solved using trim() again?

from imscjs.

nigelmegitt avatar nigelmegitt commented on July 3, 2024 1

Hi @palemieux yes I do. The reason is that it is where we have it in the BBC fork, and the reason we put it there is because we apply styling options when HTML mapping, so that they happen whenever we render an ISD, not just on document parsing. The specific example here is at https://github.com/bbc/imscJS/blob/4b194d20e590f255e4168f9d3ddfd28430b35590/src/main/js/html.js#L1470-L1472

                    if (context.options.fontFamily) {
                        attr = context.options.fontFamily.split(",");
                    }

Then we process the split attr. That way if the customisation options change then we only have to generate new HTML for the current ISD, and the syntax of the fontFamily option is the same as the syntax in the TTML document, which can include spaces.

from imscjs.

palemieux avatar palemieux commented on July 3, 2024 1

@mattjuggins It sounds like adding a trim() at time of parsing should work.

from imscjs.

palemieux avatar palemieux commented on July 3, 2024

When specified, tts:fontFamily="default" is parsed as "monospaceSerif" per

function (str) {
.

The initial value of tts:fontFamily is also aliased to "monospaceSerif" since initial values, as specified in TTML, are subjected to the same parsing.

Do you have a test case that demonstrates the issue you are encoutering?

from imscjs.

palemieux avatar palemieux commented on July 3, 2024

@nigelmegitt Do you recall why trim() at #246 was applied during HTML mapping instead of TTML parsing?

https://github.com/nigelmegitt/imscJS/blob/13c449b22d570d8ec722f6ff11934de2f5ef4fa9/src/main/js/html.js#L1403

instead of:

if (ffs[i].charAt(0) !== "'" && ffs[i].charAt(0) !== '"') {

from imscjs.

nigelmegitt avatar nigelmegitt commented on July 3, 2024

I agree, that should work.

from imscjs.

mattjuggins avatar mattjuggins commented on July 3, 2024

Excellent. Thanks both. I've opened up #251 for this.

from imscjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.