0.8.1 How to Print a String with a lower font size

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

User avatar
esmetaman
Advanced Member
Posts: 311
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain
Contact:

0.8.1 How to Print a String with a lower font size

Postby esmetaman » Sat May 10, 2014 5:08 pm

I would like to print in the screen a message but I would like to configure the screen to show the characters with a lower size.

How to do it?

Code: Select all

System.out.println("LONG EXAMPLE SHOWED IN 2 LINES");
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
https://github.com/jabrena/livingrobots
http://www.iloveneutrinos.com/

RMS
New User
Posts: 2
Joined: Fri May 02, 2014 11:14 pm

Re: 0.8.1 How to Print a String with a lower font size

Postby RMS » Sun Sep 14, 2014 4:45 pm

You need to configure the LCD before and use

GraphicsLCD gLCD = LocalEV3.get().getGraphicsLCD();
g.setFont(Font.getSmallFont());

and use

gLCD.drawString("LONG EXAMPLE SHOWED IN 2 LINES", 5, 0, 0);

for output.

This code snippet directly shows the 3 available font sizes (LeJOS 0.81):

Code: Select all

GraphicsLCD gLCD = LocalEV3.get().getGraphicsLCD();
gLCD.setFont(Font.getSmallFont());      
gLCD.drawString("Test SMALL", 2, 20, 0);
gLCD.setFont(Font.getDefaultFont());
gLCD.drawString("Test DEFAULT", 2, 40, 0);
gLCD.setFont(Font.getLargeFont());
gLCD.drawString("Test LARGE", 2, 70, 0);


system.out.println does not support formatting, starts output on upper left corner of the screen and seems to always use DEFAULT font size, which is the medium size.

Hope this helps.

Best regards
RMS


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 1 guest