Saturday, December 16th 2017, 4:31am UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

mcubebry

Beginner

Date of registration: Jun 16th 2017

Posts: 6

1

Tuesday, July 18th 2017, 12:13pm

String is not completely displayed using TTF!

Hi,

I'm using STemWin to display multi-language font(Google Noto Sans), and Everything is working except that sometimes whole sentence is not displayed.

For example, if I want to display "In another moment \n", sometimes the LCD only shows "in another mom".

It seems line-based problem and always the end of sentence(right-end) is skipped.

I'm using GUI_TTF engine and suspecting that when GUI_TTF_CreateFont() (or GUI_TTF_CreateFontAA()) is called, it doesn't get the width information of each character.

I've been testing different fonts, different boards(including STM32F769I-EVAL and custom board), and different strings, different display locations, different emWin APIs(GUI_DispString / GUI_DispStringAt....)

but this problem won't seem to go away.



Here's some solutions I've been discovered:

1. When display string, separating the whole sentence char by char solves the problem.


Here's the API I wrote to do this:

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void DispCharByChar(char * string)
{
	char *pstr, pdest[4], octet;
	int size, numbyte, strlength; 
	pstr = string;
	size = GUI_UC_GetCharSize(pstr);
	for (; *string; ++string)
	{
		if ((*string & 0xC0) != 0x80)	
		{
			++strlength;
		}
	}
	while(strlength)
	{
		for(numbyte = 0; numbyte < size; numbyte++)
		{
			octet = *(pstr + numbyte);
			pdest[numbyte] = octet;
		}
		pdest[numbyte] = 0; //insert null character to end the single-character string
		GUI_UC_SetEncodeUTF8();
		GUI_DispString(pdest);
		pstr += size;

		size = GUI_UC_GetCharSize(pstr);
		strlength--;
	}
}

2. If I input long blank at the end of the string like "In another moment         " solves the problem.


What I want to do is to use variety of String Display APIs STemWin offers!

Thanks for your help in advance!

Regards,
Boram

This post has been edited 3 times, last edit by "mcubebry" (Jul 18th 2017, 12:18pm)


SEGGER - Schoenen

Super Moderator

Date of registration: Aug 13th 2015

Posts: 443

2

Wednesday, July 19th 2017, 3:10pm

Hi,

Indeed, it seems there is something working properly. We will check this and fixes this as soon as possible.

On our side it disappeared after we a call of GUI_DispChar(' ') (it is a space character). Please try if this works on your side.

Regards,
Sven