Skip to content

display.drawString() cannot utilize the first rows of the display #369

Open
@flyvert

Description

@flyvert

I've already made a post here https://forum.arduino.cc/t/ssd1306wire-font-alignment-problem/978025
I then realized I can post an issue here on GitHub.

Library version 4.3.0. Arduino 1.8.13. macOS 12.2 (21D49). Generic ESP8266.

The drawString() seem unable to draw text at the first pixel rows of the display. I have a thermometer project where I want to maximize two temperature readings on a 128x64 display - I have experimented with creating a large font and is currently using a 34 pixel version of Sans Serif which looks nice on the pixels I've been able to utilize, however, there is some space left unused.

A call to drawstring(0,0...) leaves several pixels (the more the larger the font size used) unused at the top of the display. Using a smaller font moves text upwards

Here below two examples giving a hands on view of the problem.

  1. Notice the smaller 10 pixel font starts above the 34 larger font, both drawn at row 0 - still a drawLine on row 0 is painted above both texts.

display.setFont(ArialMT_Plain_10);
display.drawString(95,0, "toprow");
display.drawLine(0,0,128,0);

  1. Notice a rectangle on the last pixels of the screen. The first text row (drawn at 0,0) is clearly below the top while the second text row can be put exactly on the bottom row (I can't recall if text was starting at pixel 32, however, I am able to tweak the text to draw at the bottom pixel row).

display.setFont(SansSerif_Plain_34);
display.drawString(0, 0, "12.3°");
display.drawString(0, 32, "12.3°");
display.drawRect(0,0,128,64);

IMG_1403
IMG_1404

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions