From: Andrew T. <an...@fu...> - 2011-07-27 06:34:54
|
Hi, I have found one issue since posting the patch, the escape char is counted in the string length despite not being displayed. I just set the width for my text widget to be longer than the lcd width to account for this. Andrew On 27 July 2011 17:43, Michael Reinelt <mi...@re...> wrote: > Hi Andrew, > > sorry for being *that* late :-( > > thanks a lot for your patch, I really like the idea! Committed to trunk! > > any volunteers to add documentation to the wiki? > > > Am 2011-05-18 00:41, schrieb Andrew Thompson: >> >> Hi, >> >> >> I have an application that writes out the lcd data to a file (as >> opposed to writing a custom plugin) and I need to make some words >> bold. I have hacked this up locally to make the ascii BEL char as a >> bold toggle. >> >> This works quite well for me so I am sharing it. The BEL char may not >> be a good choice vs. the proper ANSI escape sequences but is easier to >> implement. >> >> >> --- drv_generic_graphic.c.orig 2011-05-12 10:11:40.000000000 +1200 >> +++ drv_generic_graphic.c 2011-05-18 10:13:51.000000000 +1200 >> @@ -233,6 +233,7 @@ >> const char *style, const char *txt) >> { >> int c, r, x, y, len; >> + int bold; >> >> /* sanity checks */ >> if (layer< 0 || layer>= LAYERS) { >> @@ -249,10 +250,17 @@ >> c = col; >> >> /* render text into layout FB */ >> + bold = 0; >> while (*txt != '\0') { >> unsigned char *chr; >> >> - if (strstr(style, "bold") != NULL) { >> + /* magic char to toggle bold */ >> + if (*txt == '\a') { >> + bold ^= 1; >> + txt++; >> + continue; >> + } >> + if (bold || strstr(style, "bold") != NULL) { >> chr = Font_6x8_bold[(int) *(unsigned char *) txt]; >> } else { >> chr = Font_6x8[(int) *(unsigned char *) txt]; >> >> >> >> The snippets from my lcd4linux.conf >> >> Layout picoLCDGraphic { >> Row1 { >> Col1 'status1' >> } >> Row2 { >> Col1 'status2' >> } >> ... >> } >> Widget status1 { >> class 'Text' >> expression file::readline(statfile, currline) >> width 42 >> update tick >> } >> Widget status2 { >> class 'Text' >> expression file::readline(statfile, currline+1) >> width 42 >> update tick >> } >> ... >> >> >> ------------------------------------------------------------------------------ >> What Every C/C++ and Fortran developer Should Know! >> Read this article and learn how Intel has extended the reach of its >> next-generation tools to help Windows* and Linux* C/C++ and Fortran >> developers boost performance applications - including clusters. >> http://p.sf.net/sfu/intel-dev2devmay >> _______________________________________________ >> Lcd4linux-devel mailing list >> Lcd...@li... >> https://lists.sourceforge.net/lists/listinfo/lcd4linux-devel >> >> > > -- > Michael Reinelt <mi...@re...> > http://home.pages.at/reinelt > GPG-Key 0xDF13BA50 > ICQ #288386781 > |