Control the color of characters' inside separately from their contour (text function)

26 ビュー (過去 30 日間)
z8080
z8080 2020 年 8 月 29 日
コメント済み: z8080 2020 年 8 月 29 日
When using the `text` function, by changing the colour of the font one only changes the face (inside) colour. Is there a way to also control the colour of the edge (contour) of the letter? I found no information about this in the Matlab (2016) documentation or on forums.

採用された回答

Adam Danz
Adam Danz 2020 年 8 月 29 日
編集済み: Adam Danz 2020 年 8 月 29 日
No, there is no text-edge property.
You can change the background color ('BackgroundColor') of the rectangle that frames the text object and the text color ('Color') but the text does not have a separate edge property.
You might be able to find a font that has a black border and white interior or something like that (example).
You can kind of get a text-edge effect by plotting the same exact text twice and....
  • use bold font weight with the first and normal font weight with the second
  • use a fixed-width font to preserve the letter spacing
  • use identical font size, text position, and text alignment
but that's the closest you can get without converting text to patch objects or using some other non-text function.
clf()
arch = ['Stand away, fellow,',newline,'from my diagram!'];
text(.2, .5, arch, 'Color', 'b', 'FontName', 'Consolas', 'FontSize', 18, 'FontWeight', 'bold');
text(.2, .5, arch, 'Color', 'r', 'FontName', 'Consolas', 'FontSize', 18);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by