Giter VIP home page Giter VIP logo

Comments (7)

anthrotype avatar anthrotype commented on August 27, 2024

thanks @mashabow
honestly, I am not sure how to fix this, or even whether it actually is something that needs to be fixed.

Maybe the following comment provides some clue as to how compreffor deals with such local subroutines called from global ones:

# assert this is a local or global only used by one FD

https://github.com/googlei18n/compreffor/blob/932a60b/src/python/compreffor/pyCompressor.py#L901

I'm hoping @behdad could have a look at this when he has some spare time.
@mashabow, you are welcome to send a pull request, of course.

from compreffor.

mashabow avatar mashabow commented on August 27, 2024

honestly, I am not sure how to fix this, or even whether it actually is something that needs to be fixed.

I am not sure whether it should be fixed, too. As @miguelsousa says, it doesn't seem this restriction has been documented. In addition, such fonts work fine in major applications as far as I checked.

from compreffor.

behdad avatar behdad commented on August 27, 2024

Should be possible to not generate those. Though, someone who understand the code well needs to go in and do that surgery.

from compreffor.

mashabow avatar mashabow commented on August 27, 2024

https://github.com/googlei18n/compreffor/blob/932a60b/src/python/compreffor/pyCompressor.py#L753-L787

This block seems to put each candidate subroutine in global or local subroutines. So if we really want to avoid such "invalid" global ones, we have to check whether a candidate subr contains callsubr operator before calling Compreffor.insert_by_usage(subr, gsubrs).

from compreffor.

behdad avatar behdad commented on August 27, 2024

https://github.com/googlei18n/compreffor/blob/932a60b/src/python/compreffor/pyCompressor.py#L753-L787

Somewhere around that, yes.

from compreffor.

behdad avatar behdad commented on August 27, 2024

This block seems to put each candidate subroutine in global or local subroutines

If that block is to be trusted, looks like it only does that if there's only one FontDict. Is that consistent with what you are seeing? If yes, we can update subsetter to also do that. Makes sense to me.

from compreffor.

mashabow avatar mashabow commented on August 27, 2024

This block seems to put each candidate subroutine in global or local subroutines

If that block is to be trusted, looks like it only does that if there's only one FontDict.

No. It may insert into global subroutines, even if there are multiple FontDicts. This is a pseudocode for that block:

while candidate_subrs and (some lsubrs/gsubrs has space):
    subr = candidtate_subrs.pop()
    if subr is called from glyphs which are all in one FD:
        if gsubrs has space:
            if lsubrs has space:
                insert subr into gsubrs or lsubrs, minimizing the cost
            else:
                insert subr into gsubrs
        else lsubrs has space:
            insert subr into lsubrs
        else:
            no room, give up inserting
    else:
        if gsubrs has space:
            insert subr into gsubrs
        else:
            no room, give up inserting

from compreffor.

Related Issues (17)

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.