Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
Bold a specific word in a sentence in quotation marks in visual studio code

so I was tasked to create a game in visual studio code using phaser.io for help. At the moment, I was told to bold a specific word in a sentence that is in quotation marks, but I am not sure how to do show. This is all in a Javascript file.

const text3 = this.add.text(
  650,
  460,
  "Answer: Have a budget plan to save up money to buy it.",
  { fontFamily: "Roboto", fill: "black" }
);

I am suppose to bold the word "Answer" that is in quotation marks, so it should look like such

const text3 = this.add.text(
  650,
  460,
  "**Answer**: Have a budget plan to save up money to buy it.",
  { fontFamily: "Roboto", fill: "black" }
);

Can someone help me out with this?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try this

const text3 = this.add.text(
  650,
  460,
  "Answer: Have a budget plan to save up money to buy it.",
  { fontFamily: "Roboto", fill: "black" }
);

text3.addFontWeight('bold', 0); // 0 means the start of the text
text3.addFontWeight('normal', 6); // change it to normal starting from index 6 of the text

See: Documentation

about 4 years ago · Juan Pablo Isaza Relatório

0

Phaser 3

Inline styling of text is no supported natively, as per this github issue.

It's worth mention rexBBCodeText & rexTagText that could help you to manage inline style in a better way (using BBCode or html tags).

In any case, if you really need to use this syntax **Answer**, it's better to split the string and manage each part alone.

Phaser 2 CE

This old version manage text in a different way and you could use addFontWeight specifying the beginning inside the string of the change in weight.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda