<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Cannot canvas.drawString() onto canvas. (M5PaperTouchArea)]]></title><description><![CDATA[<p dir="auto">I have made a small modification to RAWSEQ'sexcellent  <a href="https://github.com/RAWSEQ/M5PaperTouchArea" target="_blank" rel="noopener noreferrer nofollow ugc">M5PaperTouchArea</a>  project.</p>
<p dir="auto">I am trying to use the spare white area as an output canvas. I can place the CanvasOP (output canvas) correctly and I can check it is really there by filling it in different shades and moving it around. but I cannot write into it. Any canvasOP.drawString() commands seem to be ignored. I have tried changing the text color, size and position but I cannot seem to get text to show up on the pushed canvasOP.</p>
<pre><code class="language-cpp">#include &lt;M5EPD.h&gt;
#include "M5PaperTouchArea.h"
#include "MPlusFontsSubset.h"

// M5EPD Canvas
M5EPD_Canvas canvas(&amp;M5.EPD);
M5EPD_Canvas canvasOP(&amp;M5.EPD);

// Module (Grid &amp; TouchArea)
M5PaperTouchAreas _m5pta;

// Module (Grid Only)
GridUtil _gu;

void setup() {

  // Display Setup
  M5.begin();
  M5.EPD.SetRotation(90);
  M5.TP.SetRotation(90);
  M5.EPD.Clear(true);
  canvas.loadFont(MPlusFontsSubset, sizeof(MPlusFontsSubset));
  canvas.createCanvas(540, 960);
  canvas.createRender(48, 256);
  canvas.fillRect(0, 0, 540, 960, 10);
  _m5pta.current_canvas = &amp;canvas;
  _m5pta.getGutil()-&gt;setVertical(true);
  _gu.setVertical(true);

  // Event Setting
  _m5pta.e_touch.func = bTouch;
  _m5pta.e_release.func = bRelease;

  // Change Default Setting
  _m5pta.default_font_size = 48;
  _m5pta.default_radius = 15;
  _m5pta.default_font_linepos = 6;
  _m5pta.default_bc = { 13, 0, 0 };

  // Touch Area Test
  _m5pta.add_grid(1, 1, 1, 1, "B1", "b1");
  _m5pta.add_grid(2, 1, 1, 1, "B2", "b2");
  _m5pta.add_grid(3, 1, 1, 1, "B3", "b3");
  _m5pta.add_grid(4, 1, 1, 1, "B4", "b4");
  _m5pta.add_grid(5, 1, 1, 1, "B5", "b5");
  _m5pta.add_grid(1, 2, 3, 1, "B6", "b6");
  _m5pta.add_grid(4, 2, 2, 1, "B7", "b7");
  _m5pta.add_grid(1, 3, 2, 1, "B8", "b8");
  _m5pta.add_grid(3, 3, 3, 1, "B9", "b9");
  _m5pta.add_grid(1, 4, 5, 1, "B10 Steve", "Steve");
  _m5pta.add_grid(1, 5, 2, 1, "B11", "b11");
  //_m5pta.add_grid(3, 5, 3, 2, "B16", "b16");//added by steve
  _m5pta.add_grid(1, 6, 2, 2, "B12", "b12");
  _m5pta.add_grid(3, 7, 3, 3, "B13", "b13");
  _m5pta.add_grid(1, 8, 2, 1, "B14", "b14");
  _m5pta.add_grid(1, 9, 2, 1, "B15", "b15");
  _m5pta.draw();

  // Grid Draw Test
 // GURect g = _gu.convert(3, 5, 3, 2);
//  canvas.setTextColor(10);
 // canvas.fillRect(g.x, g.y, g.w, g.h, 0);
  canvas.pushCanvas(0, 0, UPDATE_MODE_GC16);
 /*  Serial.print(g.x);
  Serial.print("...");
  Serial.print(g.y);
    Serial.print("...");
  Serial.print(g.w);  
  Serial.print("...");
  Serial.print(g.h);*/
  //230...440...290...180 g.cordinates
  canvasOP.createCanvas(290, 180);
  //canvasOP.fillCanvas(5);
  canvasOP.setTextSize(4);
  canvasOP.setTextColor(15);
  canvasOP.drawString("Hello", 20, 100);
  canvasOP.pushCanvas(230, 440, UPDATE_MODE_GC16);
}

// Touch Event
void bTouch(M5PTAEventContext&amp; ct) {
  Serial.println("T:" + ct.code);

}

// Release Event
void bRelease(M5PTAEventContext&amp; ct) {
  Serial.println("R:" + ct.code);

}

void loop() {
  _m5pta.loop();
}

</code></pre>
]]></description><link>https://community.m5stack.com/topic/5854/cannot-canvas-drawstring-onto-canvas-m5papertoucharea</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 23:33:37 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5854.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 29 Nov 2023 09:43:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cannot canvas.drawString() onto canvas. (M5PaperTouchArea) on Wed, 29 Nov 2023 19:57:58 GMT]]></title><description><![CDATA[<p dir="auto">I am just starting out with the M5Paper and a lot of things are taking some getting use to. I thought about deleting this thread when I found out how easy the solution was but then I thought that maybe this will help someone else. So here is the solution:</p>
<p dir="auto">You have to declare a font for use in the canvasOP. So adding his line after creating canvasOP fixes the problem:<br />
<em>canvasOP.setFreeFont(&amp;FreeSerif24pt7b);</em></p>
]]></description><link>https://community.m5stack.com/post/22928</link><guid isPermaLink="true">https://community.m5stack.com/post/22928</guid><dc:creator><![CDATA[Steve1]]></dc:creator><pubDate>Wed, 29 Nov 2023 19:57:58 GMT</pubDate></item></channel></rss>