Questions tagged [drawtext]

340 questions
9
votes
2 answers

why my invoke of Canvas.drawText() just doesn't work

Hi all: I'm writing a class that inherit from TextView, and override its onDraw() method, but in the method, my invoke of canvas.drawText() doesn't seems to work, the code just like below: protected void onDraw(Canvas canvas) { //…
Vince.Wu
  • 870
  • 1
  • 10
  • 17
9
votes
2 answers

Canvas draw html text

Is it possible to pass Html to Canvas.drawtext(). I tried this: canvas.drawText(Html.fromHtml("This is an underline text demo for TextView."), 0, 20, colIndex, rowIndex, getTextPaint()); But that cannot parse tags and not show…
Naruto Uzumaki
  • 2,019
  • 18
  • 37
7
votes
2 answers

Making DrawText break a string

So i can make drawtext break a string if the string has spaces, or if i put in \r\n at the end of the string. However, a long string that has no spaces or line breaks in it continues past the drawing rectangle and gets clipped. I would like to…
Gogeta70
  • 881
  • 1
  • 9
  • 23
7
votes
1 answer

ffmpeg - adding text to a video between two times

Hi I have a video which is 20 seconds long, I want to add some text to this video from 00:00:10 seconds to 00:00:15 seconds which just says "Summer Video" and fades in and out using FFMPEG. I know I have to use the drawtext filter, but has anybody…
D Mawer
  • 73
  • 1
  • 1
  • 5
7
votes
2 answers

How can I set drawtext fontsize in ffmpeg according to resolutions ratio

How can I set fontsize for drawtext on video according to width and height of each resolutions, to a certain proportion? ffmpeg -i Input.mp4 -vf drawtext="fontfile=OpenSans-Regular.ttf: \ text='New Music Video': fontcolor=white: fontsize=?: r=25:…
Parsa Saei
  • 1,263
  • 5
  • 21
  • 38
7
votes
3 answers

canvas drawtext with multiline

I am developing a image commenting application. I draw text in canvas with canvas.drawText(text, x, y, imgPaint); This appears in a single line. I need to break the line to multiline when the text crosses the canvas width Thanks in advance
varghesekutty
  • 997
  • 2
  • 11
  • 23
7
votes
2 answers

Drawing text at an angle (e.g. upside down) in Android

I'm trying to build a custom clock view in Android. See image http://twitpic.com/1devk7 So far to draw the time and hour markers I have been using the Canvas.rotate method to get the desired effect. However, notice that it is difficult to interpret…
Damian
  • 8,062
  • 4
  • 42
  • 43
7
votes
3 answers

Android 4.2 on Nexus 7: canvas.drawText() not working correctly

I'm facing a serious issue with my Application, published on Google Play and apparently working fine on all versions of Android except for > 4.0. This is a screenshoot from my Android 4.0 HTC phone: And this is what I get on Nexus 7, Android 4.2.1…
Seraphim's
  • 12,559
  • 20
  • 88
  • 129
7
votes
1 answer

A smooth very slow text animation in an Android canvas, SUBPIXEL_TEXT_FLAG not working

I can't get to achieve a smooth very slow text animation in a Canvas because Canvas.drawText doesn't want to draw "between pixels". For example, given 4 consecutive frames where I draw a text with an Y offset of 0, 0.5, 1, 1.5, the canvas will…
Joan
  • 143
  • 2
  • 9
6
votes
1 answer

DrawText with DT_CALCRECT - Is there a way to calculate the height of the rect WITHOUT modifying the width (with large strings)?

I have a string that i need to calculate the Rect size (text height) when drawing. My implementation uses the DrawTextW() function with DT_WORDBREAK or DT_CALCRECT flags. An example of my…
Simon
  • 9,197
  • 13
  • 72
  • 115
6
votes
1 answer

ffmpeg vertically center align multiple lines of text using drawtext and subtitle both filters independent of font size

I want to vertically center align the text on video no matter what the font size is. And possibly if it could be done using drawtext filter and subtitles filter as well for subtitles filter if anyone can guide how to move the lines few columns up. I…
Rehan
  • 408
  • 1
  • 6
  • 17
6
votes
3 answers

How to know the size of a text when using Canvas.drawText()

I'm using the Canvas.drawText() to write text on a custom view. I want to add a background 9-patch drawable behind the text, so I need to know the boundaries of the text drawn. The text is given by the user, so it's not a fixed size. For now I'm…
XGouchet
  • 10,002
  • 10
  • 48
  • 83
6
votes
1 answer

Draw a text on a circle path in android

I need to draw a text on a circle path. I have tried the drawTextOnPath() method. But for texts like "fertile window" in the image attched, the text rotates and is not readable. Code I have used : customPath2.addArc(mCircleRectF, 30F, 64.28F); …
Sahana Prabhakar
  • 581
  • 1
  • 8
  • 21
6
votes
2 answers

Set VerticalAlignment in DrawText

I'm using DrawText to draw FormattedText on Visual Layer. Now I'm using the code below to define the formatted text and I'm able to set the TextAlignment to Center. But what about the VerticalAlignment? As you can see in the image below the center…
Vahid
  • 5,144
  • 13
  • 70
  • 146
5
votes
1 answer

Draw text vertically on canvas

I would like to learn how to draw vertical text on the canvas. Sorry for maybe stupid question, but I can not solve this problem. I can do so: if (i ==10) { this_str2 = "0.00"; } canvas.save(); …
Domos
  • 193
  • 3
  • 11
1
2
3
22 23