MV bitmap.drawText Help!

Hi!
I'm struggling to make text appear on a Sprite's bitmap, with the goal being to overlay a UI sprite with a value. I can make a child sprite to draw on assigned to that UI sprite, initialize its bitmap etc, even edit its bitmap with bitmap.fillAll, but I can't get text to display on it. The script I'm running looks like:

JavaScript:
uiSprite.children[0]._uiValue.bitmap.drawText(`test value`, 0, 4, 32, 32, `center`);

I've tried nudging the x and y to be positive and negative values, in case the text was just being drawn out of view, but with no luck.
And the following does work, so I know that the child bitmap is being drawn to the correct height and width and is correctly situated above the parent sprite:
Code:
uiSprite.children[0]._uiValue.bitmap.fillAll('rgba(0,0,0,0.1)');

I've also tried adding textColor and fontSize properties using the following, with no observable change:

Code:
this._uiValue.bitmap.textColor = '#ffffff';
this._uiValue.bitmap.fontSize = Window_Base.standardFontSize;

Any help would be appreciated! can't find much discussion about bitmap.drawText online.

*Also, when I try to target enemy sprites with bitmap.drawText to test, I end up with similar results; no visible text is able to be drawn on the sprite with the way I'm writing the command (same as above.) On windows, I'm able to make bitmap.drawText display visibly as expected. Is what I'm trying to do even possible on Sprites?
Hi!
I'm struggling to make text appear on a Sprite's bitmap, with the goal being to overlay a UI sprite with a value. I can make a child sprite to draw on assigned to that UI sprite, initialize its bitmap etc, even edit its bitmap with bitmap.fillAll, but I can't get text to display on it. The script I'm running looks like:

JavaScript:
uiSprite.children[0]._uiValue.bitmap.drawText(`test value`, 0, 4, 32, 32, `center`);

I've tried nudging the x and y to be positive and negative values, in case the text was just being drawn out of view, but with no luck.
And the following does work, so I know that the child bitmap is being drawn to the correct height and width and is correctly situated above the parent sprite:
Code:
uiSprite.children[0]._uiValue.bitmap.fillAll('rgba(0,0,0,0.1)');

I've also tried adding textColor and fontSize properties using the following, with no observable change:

Code:
this._uiValue.bitmap.textColor = '#ffffff';
this._uiValue.bitmap.fontSize = Window_Base.standardFontSize;

Any help would be appreciated! can't find much discussion about bitmap.drawText online.

*Also, when I try to target enemy sprites with bitmap.drawText to test, I end up with similar results; no visible text is able to be drawn on the sprite with the way I'm writing the command (same as above.) On windows, I'm able to make bitmap.drawText display visibly as expected. Is what I'm trying to do even possible on Sprites?
I think I might understand what you are asking for (otherwise, my apologies in advance).

Is your sprite a character on a spritesheet? If so, this means that the bitmap is actually much bigger than what you see since the character itself is only a frame of the bitmap that you see. When you "write" on the bitmap, it actually writes the text on the ENTIRE bitmap instead of just the character that you see on the screen.

Here is Harold from Actor1.png which is 576x384.

This is the code I used:
Spoiler
JavaScript:
SceneManager._scene._spriteset._characterSprites.find(c =>
  c._character === $gamePlayer).bitmap.drawText('hello', 48, 48, 48, 0, 'center')

Here is what I saw the moment I ran the code in the console:
Facing Down:
1762724239625.png

Facing Left:
1762724278251.png

Facing Up:
1762724302347.png

This means that by editing the bitmap directly, the word 'hello' is written on the coordinates 48x48 on the actual bitmap, which is affected by the frame that Harold is on currently which can be on frame/cell 0, 1, or 2 and row 1, 2, 3, or 4 (down, left, right, or up direction).

I would avoid editing the bitmap directly in this case and either creating a new PIXI.Text all together to anchor itself on the character, or, create a new bitmap for it.

Here is PIXI Text (we will add it to the $gamePlayer sprite):
Spoiler
JavaScript:
const p = SceneManager._scene._spriteset._characterSprites.find(c =>
  c._character === $gamePlayer);
const t = new PIXI.Text('hello', {fill: 'white', strokeThickness: 4});
t.anchor.set(0.5, 1);
p.addChild(t);

1762724787547.png

Here is its variation using bitmap:
Spoiler
JavaScript:
const p = SceneManager._scene._spriteset._characterSprites.find(c =>
  c._character === $gamePlayer);
const b = new Bitmap(96, 48);
b.drawText('hello', 0, 0, 96, 48, 'center');
const s = new Sprite(b);
s.anchor.set(0.5, 1);
p.addChild(s);

1762725226061.png
Let me know if this works for what you are doing or if you need something more specific. Also, if you have a screenshot of how you are using your code, it would be helpful.

Keep in mind that PIXI Text requires you to define other parameters in style property so you'll need to look up the Text Styles for PIXI JS to get more info on it.

Thanks!
It worked!!!!!!!!
Using your example code to see how bitmap.drawText looked like when it worked was really helpful. My issue was with my drawValue function (which called drawText on my properly-formed sprite and bitmap) being called on the wrong child, or something-- It started displaying visuals when I spliced in your demo code at that point.
I actually found reference to PIXI.text when I was looking at pixiJS documentation, and will probably should use that for UI going foward. I really appreciate you taking the time to demonstrate both approaches with visuals, you're really a lifesaver.

Original thread: https://forums.rpgmakerweb.com/threads/bitmap-drawtext-help.180938/