nvgText() and extended ASCII characters?

Hi,

Is existing a way to display extented ASCII character(s) by nvgText() method, from widget? or alternative way…

The character I want to display is degree symbol, °, ASCII 176.

Thanks in advance for your advice.

I think you just need to paste the character into a string in your code. If you have a look in the rack source code, CHECKMARK_STRING and RIGHT_ARROW are defined in common.hpp as:

#define CHECKMARK_STRING "✔"

#define RIGHT_ARROW "▸"
1 Like

I think as long as the font you are using supports the glyph it should be just fine to use extended characters, as the Count says, just paste the character in as a string… if that doesnt work or your editor doesnt like it, you can use an escape sequence

Depending on the font you can get great results, see here on my module the title uses an icon font VCV Library - DanT Kalkatron

Here are the Google icon fonts

2 Likes

Thanks CountModula & Dan, I’ll test this ASAP!

Kalkatron seems an amazing module! I’ll give it a chance. :ok_hand: Thank you.

1 Like

In case it helps, here is the type of code that draws the title icon for Kalkatron, the codepoints file next to the font file indicates which escape sequence to use for each icon:

std::shared_ptr<rack::window::Font> font = APP->window->loadFont(rack::asset::plugin(pluginInstance, "font/MaterialIcons-Regular.ttf"));
nvgFontFaceId(vg, font->handle);
nvgFontSize(vg, 14.0f);
nvgTextLetterSpacing(vg, 0.0f);
nvgTextAlign(vg, static_cast<int>(NVG_ALIGN_CENTER | NVG_ALIGN_TOP));
nvgBeginPath(vg);
nvgFillColor(vg, nvgRGBA(0, 0, 50, 255));
nvgText(vg, xPos, yPos, "\uea5f", NULL);
nvgFill(vg);
1 Like

For this new (incoming) module - KlokSpid MkII:

When I set the phase shift by the horizontal fader, at the moment the parameter readout (above fader, yellow color) indicates the Phase Shift but as percent (-50% to +50%) - or “IN-PHASE” when centered:

image

My goal is to display the phase shift in degrees, from -180° (left position) to 180% (right position), instead of percent.

I’ll try you tip next evening (France time), hope it will work. At the moment I’m working hard on wavetable support…

Thanks Dan.

2 Likes

Looks cool :sunglasses:

1 Like

Thanks - but it’s a monster, perhaps a bit complicated (without experience on it) a bit can of worms sometimes… lol :wink:

DanT plugin (all modules) is installed, Moar Cowbell looks fantastic, I love the original design, well done!

BINGO! (now I’ll must re-adjust the readout above fader) - Thanks a million.

Using “\u00b0” to display degree symbol (using “\0xb0” doesn’t work - it was my issue).

1 Like