A question on using the T35 Display

This is not a gripe. Only a general question.

I noticed a strange (to me) text output using the following:

private void serial_DataReceived(Object sender, SerialData data)
{
byte[] buffer = new byte[serial.BytesToRead];
if (buffer.Length > 0)
{
serial.Read(buffer, 0, buffer.Length);
string UTF8Text = new string(Encoding.UTF8.GetChars(buffer));
txtData = new Text(baseFont, UTF8Text);
canvas.Children.Add(txtData);
Canvas.SetTop(txtData, 160);
Canvas.SetLeft(txtData, 5);
}

The string received is from the following:

serial.WriteLine(“WiFly reset”);
Or
serial.Write(“WiFly reset\n”);

Both of the above will display the Text object as WiFly…

I assume now that control characters are not allowed. For some reason I assumed that the display contained common control characters in the font.

Where can I find info on the display character set?

Thanks

The T35 is a graphics display, not a character display. It does not have an associated font.

@ willgeorge - I use a modified version of this code http://tinyclr.com/forum/21/5799/ to print text to the T35. Works great.

Thanks for the link.

I do realize that the T35 is a graphics display. My question was poorly worded.

I wanted to say… I wanted information about the Font resource used when printing to the display.
I know what the files are but how can I view the contents.

The text given to - Microsoft.SPOT.Presentation.Controls.Text does not give an error when I used the control characters. And somewhere the code truncates the text after a space or sometimes two spaces. I am not sure what begins the truncate.

Examples:
“Theserialdeviceisopen\n” prints as: Theserialdeviceisop…
“Theserial device is open\n” prints as: Theserial device is…
"\nThe serial device is open\n" prints as: …

This is not an issue with me. Just curious.

All I need to do is format the incomming text because the text is used in several areas of my code and the control characters are important for some useage.

Have a great day!

You can use the .NET Micro Framework to convert TT fonts and include whatever characters you like; it can even create AA fonts for you. :slight_smile:

Sounds to me more like this is a problem of drawing test in a limited rectangle space, and having the system truncate your string to fit it all in. @ willgeorge, how are you displaying text on the screen? Can you post the actual line of code for text drawing?

MoonDragon

Not my original code but this does the same thing. I do not have a web cam (or cell phone) so I cannot post a picture. I guess I am the only person on earth without a cell phone…

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;

//A Gadgeteer console application

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp1
{

public partial class Program
{

    private Text txtSerial;
    private Text test;
    private Canvas canvas;
    private Font baseFont;

    void ProgramStarted()
    {
        SetupWindow();
        Debug.Print("Program Started");
    }

    private void SetupWindow()
    {
        var window = display.WPFWindow;
        baseFont = Resources.GetFont(Resources.FontResources.NinaB);
        canvas = new Canvas();
        window.Child = canvas;

        //
        // The following displays as intended: (OK)
        //
        txtSerial = new Text(baseFont, "The serial device is open");
        canvas.Children.Add(txtSerial);
        Canvas.SetTop(txtSerial, 40);
        Canvas.SetLeft(txtSerial, 60);

        // The following displays as:   The serial device is...
        //
        txtSerial = new Text(baseFont, "The serial device is open\n");
        canvas.Children.Add(txtSerial);
        Canvas.SetTop(txtSerial, 60);
        Canvas.SetLeft(txtSerial, 60);

        // The following displays as:   The serial...
        //
        txtSerial = new Text(baseFont, "The serial device\r\nis not open\r\n");
        canvas.Children.Add(txtSerial);
        Canvas.SetTop(txtSerial, 80);
        Canvas.SetLeft(txtSerial, 60);

        // The following displays as:   What looks like the Alt 0141 character (a vertical outlined rectangle) then ...
        //
        txtSerial = new Text(baseFont, "\r\nThe serial device is not open");
        canvas.Children.Add(txtSerial);
        Canvas.SetTop(txtSerial, 100);
        Canvas.SetLeft(txtSerial, 60);

        // The following displays as:   What looks like the Alt 0141 character (a vertical outlined rectangle) then The serial device is not open
        //
        txtSerial = new Text(baseFont, "\rThe serial device is not open");
        canvas.Children.Add(txtSerial);
        Canvas.SetTop(txtSerial, 120);
        Canvas.SetLeft(txtSerial, 60);

        // The following displays as intended: (OK)
        //
        test = new Text(baseFont, "01234567890123456789012345678901234567890123456789\n");
        canvas.Children.Add(test);
        Canvas.SetTop(test, 180);
        Canvas.SetLeft(test, 0);

        // The following displays as:   0123456789012345678901234567... 
        //
        test = new Text(baseFont, "012345678901234567890123456789\n01234567890123456789");
        canvas.Children.Add(test);
        Canvas.SetTop(test, 200);
        Canvas.SetLeft(test, 0);

        // The following displays as intended: (OK)
        //
        test = new Text(baseFont, "01234567890123456789012345678901234567890123456789");
        canvas.Children.Add(test);
        Canvas.SetTop(test, 227);
        Canvas.SetLeft(test, 0);
    }

} //end class

}

For Skewworks

Thanks for the link. Now that you post it I remember seeing it!

I will try and see if I can do something with it…