OpenFontRender icon indicating copy to clipboard operation
OpenFontRender copied to clipboard

Update to add examples and fix compile problems

Open Bodmer opened this issue 2 years ago • 1 comments

I have forked the develop branch and made changes Existing examples have not been updated but I have added some new ones specific to TFT_eSPI Rendering has been speeded up by drawing pixel runs as lines keywords.txt added

  • added for architecture in library.properties so examples appear in IDE menu
  • sfnt file updated so library compiles for ESP32 with latest board package (which is picky)

Bodmer avatar Nov 11 '22 02:11 Bodmer

Awesome improvement. A before and after video comparison https://twitter.com/martinfasani/status/1591491026656841730

martinberlin avatar Nov 12 '22 18:11 martinberlin

@Bodmer

I am reviewing the code that you has been changed. However, There is one question, so please tell me.

Why did you comment out the sfnt code (ttcmap.c)? You left the message sfnt file updated so library compiles for ESP32 with latest board package (which is picky) , explain more particularly? (Do you mean the Warning in ESP-IDE?)

takkaO avatar Nov 16 '22 08:11 takkaO

The ESP32 board package in the Arduino environment treats some warnings as errors. The commented out function generated a compile warning that the function was "not used" and this was then treated as an error so compile failed. Commenting out the unused funtion fixes this.

Bodmer avatar Nov 19 '22 04:11 Bodmer

@Bodmer

I can't reproduce the issue in my environment, so please give me the following information.

  • Arduino IDE version
  • Board manager and version
  • Target board
  • Minimum code that can be reproduced

Screenshots are also acceptable. Thank you.

takkaO avatar Nov 19 '22 09:11 takkaO

Arduino IDE version 1.8.13 - but I suspect that does not matter. ESP Ardunio board package 2.0.5 - loaded via board manager Error message:

D:\xxx\Arduino\Sketches\libraries\OpenFontRender\src\sfnt\ttcmap.c:55:3: error: 'tt_cmap_init' defined but not used [-Werror=unused-function]
   tt_cmap_init( TT_CMap   cmap,
   ^~~~~~~~~~~~
cc1.exe: some warnings being treated as errors

The later ESP32 board packages are very picky about unused variables and unused functions.

Bodmer avatar Nov 20 '22 15:11 Bodmer

I just noticed that my compiler warnings are set to "All": image

So the unused function will not be treated as an error if the warnings are set to "None", "Default" or "More"

The palform.txt specifies the warning/error level and for the ESP32 it is strict for the "All" setting:

image

Bodmer avatar Nov 20 '22 16:11 Bodmer

@Bodmer

Thanks for the info. I was able to reproduce it in my environment (it seems that other errors were masking the desired error 😭). I also confirmed that the problem can be solved from the Arduino preferences.

This library accepts to change FreeType version, and I think that any modifications to the FreeType code should be made in ModifyLibs.sh/ps1 script. Therefore, I think I'll pass that any changes to sfnt/ttcmap.c this time. Other changes will be merged so just a moment, please.

Thank you.

takkaO avatar Nov 21 '22 15:11 takkaO

Yes, I think the change to ttcmap.c is not needed and as you say makes a version change clean.

Bodmer avatar Nov 21 '22 17:11 Bodmer