Giter Site home page Giter Site logo

Comments (11)

bluepichu avatar bluepichu commented on August 22, 2024

I should have a bit of extra time tomorrow, so I'll try to take a look.

from pixi-multistyle-text.

ArronFerguson avatar ArronFerguson commented on August 22, 2024

Thanks for looking into it!

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

Is this for a bitmap font? If not, it's not possible since text objects are backed by a canvas, which doesn't support character spacing. (See pixijs/pixijs#1748.)

The bahvior of character spacing at the edges between styles is also a bit interesting. For example, suppose wide has a large letterSpacing, and narrow has it set to 0. How should <narrow>abc<wide>def</wide>ghi</narrow> be rendered? abcd e fghi or abc d e f ghi?

from pixi-multistyle-text.

ArronFerguson avatar ArronFerguson commented on August 22, 2024

Matthew,

It's for outline fonts, not bitmap. Yeah, I was thinking probably not. No worries, you can close it. Figured I'd check with the experts though.

:)

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

I'll leave this open, since letterSpacing probably should work for bitmap fonts at least.

I might also be able to make it work for non-bitmaps by simply drawing one character at a time - which would probably be a performance hit and might cause some fonts to do strange things, but would only kick in if letterSpacing is non-zero. The only way to find out is to try. 😄

Of course, we'd still need to decide on abcd e fghi vs. abc d e f ghi. Another possibility I just thought of is to have the letterSpacing be evenly divided on both sides of a character - which would give abc-d e f-ghi, where - is half the width of a space.

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

Never mind about bitmap fonts - I didn't realize that there was a separate class for those in Pixi. We'd need to add any support for bitmap fonts before we could think of adding this feature for them, and I currently don't see any need to unless there's a particular interest in bitmap fonts.

Anyway, I'll see if drawing one character at a time works for non-bitmaps.

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

Turns out it was surprisingly straightforward.

As for my earlier question, I went with the third option - abc-d e f-ghi.

Edit:

screenshot 2017-01-20 13 47 19

That has letterSpacing set to -1 for "multiline" and to 5 for "multistyle".

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

PR filed: #40.

from pixi-multistyle-text.

ArronFerguson avatar ArronFerguson commented on August 22, 2024

OMG wow, that was fast! Thank you so much!

from pixi-multistyle-text.

tleunen avatar tleunen commented on August 22, 2024

@bluepichu What's the value of letterSpacing actually? What does represent a letterSpacing of 0 and a letter spacing of 5? Is it an offset in pixels?

from pixi-multistyle-text.

bluepichu avatar bluepichu commented on August 22, 2024

Yes.

from pixi-multistyle-text.

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.