Code Monkey home page Code Monkey logo

Comments (7)

caraus avatar caraus commented on August 29, 2024

Keyboard app. Text app. Cammands and code.:-)
Hole lot of hours.

from textdrawable.

hardikamal avatar hardikamal commented on August 29, 2024

Hey @LOG-TAG were u able to achieve that superscript (th) above 15 using this library...Please do let me know if its possible...Thnks

from textdrawable.

LOG-TAG avatar LOG-TAG commented on August 29, 2024

@hardikamal That is Designed by graphics Designers :) But you can look at this http://stackoverflow.com/questions/3543454/subscript-and-superscript-a-string-in-android http://stackoverflow.com/questions/20597223/android-textview-superscript (look at the ans by @amulyakhare )

from textdrawable.

hardikamal avatar hardikamal commented on August 29, 2024

@LOG-TAG i did this but it not working on textdrawable

from textdrawable.

sagits avatar sagits commented on August 29, 2024

Hi guys, i trying to make it:

  @Override
   public void draw(Canvas canvas) {

    // this is already on the lib
    int width = this.width < 0 ? r.width() : this.width;
    int height = this.height < 0 ? r.height() : this.height;
    int fontSize = this.fontSize < 0 ? (Math.min(width, height) / 2) : this.fontSize;
    textPaint.setTextSize(fontSize);


       //this draw one line below another
        int yHeight = 10;
        canvas.drawText(text, width / 2, yHeight, textPaint);
        yHeight += textPaint.descent() - textPaint.ascent();
        canvas.drawText(text2, width / 2, yHeight, textPaint);

}

If you wish to draw with 2 diferents fontsizes, just create another textPaint and set another TextSize.

The problem there is that i dont know how to calculate the text size to draw it on the center of the circle. Can anyone help? Thanks in advance.

from textdrawable.

SolomonBier avatar SolomonBier commented on August 29, 2024

Same issue, this ignores \n or line separators

from textdrawable.

sagits avatar sagits commented on August 29, 2024

Yes, you have to use split in yours " " and use a for loop to draw each line. I got a new idea, you can create a canvas copy, draw everything and get its size to draw centered on the real one.

from textdrawable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.