# UI Popup Window Text Alignment

**URL:** <https://forum.juce.com/t/ui-popup-window-text-alignment/35069>\
**Category:** General JUCE discussion\
**Created:** [September 3, 2019, 10:55pm UTC](https://forum.juce.com/t/ui-popup-window-text-alignment/35069 "2019-09-03T22:55:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkulik](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pkulik](https://forum.juce.com/u/pkulik)\
**Post date:** [September 3, 2019, 10:55pm UTC](https://forum.juce.com/t/ui-popup-window-text-alignment/35069/1 "2019-09-03T22:55:22Z")

</div>

Hello,

I’m trying to display a popup that shows some test results. Attempting to dynamically display the text with padding results in the misalignment shown below. Is there a way to modify the font/alignment so I can print this more neatly?

```auto
    int maxTestNameLength = 40;
	String message = "Test results from HST module on slot: " + String(slot) + " port: " + String(port) + "\n\n"; 

	np::NP_ErrorCode *results = (np::NP_ErrorCode*)(&status->VDD_A1V2);
	for (int i = 0; i < numTests; i++)
	{
		message+=String(tests[i]).paddedRight('-', maxTestNameLength - tests[i].length());
		message+=results[i] == np::SUCCESS ? "PASSED" : "FAILED w/ error code: " + String(results[i]);
		message+= "\n";
	}

	AlertWindow::showMessageBox(AlertWindow::AlertIconType::InfoIcon, "HST Module Detected!", message, "OK");

```

![HST](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/5/5247cc64f8e49ec4164431c64aa37c3cfc7637e6.png)

---

<div class="post-metadata">

**Author:** ![asimilon](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/asimilon/32/4235_2.png) [@asimilon](https://forum.juce.com/u/asimilon)\
**Post date:** [September 3, 2019, 11:07pm UTC](https://forum.juce.com/t/ui-popup-window-text-alignment/35069/2 "2019-09-03T23:07:16Z")

</div>

You’ll need to set a LookAndFeel which implements [getAlertWindowMessageFont()](https://docs.juce.com/master/structAlertWindow_1_1LookAndFeelMethods.html#af299a3c2da41c34b18c1863864e17da2) to return a fixed width font.

---

<div class="post-metadata">

**Author:** ![pkulik](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@pkulik](https://forum.juce.com/u/pkulik)\
**Post date:** [September 3, 2019, 11:52pm UTC](https://forum.juce.com/t/ui-popup-window-text-alignment/35069/3 "2019-09-03T23:52:08Z")

</div>

Worked perfectly, thanks!

```auto
Font CustomLookAndFeel::getAlertWindowMessageFont() 
{
    return Font(Font::getDefaultMonospacedFontName(), 12, 0);
}

```
