(Canvas canvas, int width, int height, float dpi, int xpos, int ypos)
| 148 | } |
| 149 | |
| 150 | @Override |
| 151 | public void draw(Canvas canvas, int width, int height, float dpi, int xpos, int ypos) { |
| 152 | var padding = 20f * dpi; |
| 153 | var textWidth = width * dpi - padding * 2; |
| 154 | var fontSize = 14.5f * dpi; |
| 155 | var variant = _variants[_variantIdx]; |
| 156 | |
| 157 | if (font == null) |
| 158 | font = new Font(inter, fontSize).setSubpixel(true); |
| 159 | |
| 160 | fill.setColor(colors[_variantIdx]); |
| 161 | |
| 162 | if (variant.startsWith("Paragraph")) |
| 163 | drawParagraph(canvas, fontSize, padding, textWidth); |
| 164 | else if (variant.startsWith("TextLine")) |
| 165 | drawTextLinesByWords(canvas, padding, textWidth); |
| 166 | else { |
| 167 | Shaper shaper = null; |
| 168 | if (variant.startsWith("Primitive")) |
| 169 | shaper = Shaper.makePrimitive(); |
| 170 | else if (variant.startsWith("ShaperDrivenWrapper")) |
| 171 | shaper = Shaper.makeShaperDrivenWrapper(); |
| 172 | else if (variant.startsWith("ShapeDontWrapOrReorder")) |
| 173 | shaper = Shaper.makeShapeDontWrapOrReorder(); |
| 174 | else if (variant.startsWith("CoreText")) |
| 175 | shaper = "Mac OS X".equals(System.getProperty("os.name")) ? Shaper.makeCoreText() : null; |
| 176 | else |
| 177 | shaper = Shaper.makeShapeThenWrap(); |
| 178 | |
| 179 | if (shaper != null) { |
| 180 | if (variant.endsWith("by words")) |
| 181 | drawByWords(shaper, canvas, padding, textWidth); |
| 182 | else |
| 183 | drawTogether(shaper, canvas, padding, textWidth); |
| 184 | shaper.close(); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | @Override |
| 190 | public boolean scale() { |
nothing calls this directly
no test coverage detected