Skip to content

Conversation

@vmichnowicz
Copy link
Contributor

Bitmap text with support for multiple text styles via HTML tags. Also allow for line breaks and custom color fill.

var text = new Kinetic.BitmapText(),
  img = new Image();

img.src = 'data:image/gif;base64...';

text.setAttrs({
  text: 'normal text<b>BOLD Text</b><br><i>italic text</i>',
  image: img,
  fill: 'blue', // Fill all non-transparent parts of image with this color
  chars: {
    standard: {
      a: [0, 0, 8, 10],
      b: [9, 0, 8, 10],
      c: [17, 0, 6, 10],
    },
    b: {
      a: [0, 12, 10, 10],
      b: [11, 12, 9, 10],
      c: [21, 12, 8, 10],
    },
    i: {
      a: [0, 23, 8, 10],
      b: [8, 23, 8, 10],
      c: [17, 23, 7, 10],
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant