Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:18:41+00:00 2026-06-15T03:18:41+00:00

I want to display Hebrew text with vowel points (nikkud) using the Canvas.drawText interface.

  • 0

I want to display Hebrew text with vowel points (nikkud) using the Canvas.drawText interface. The vowel points come out misaligned, as in the following image taken using a Motorola Defy+ device:

Misaligned vowels

The hiriq is between the resh and the yod, the holam between the vav and nun.
I have added the rtl code (\u200F) to the string at both ends, no joy.
I know that there are applications that have solved this problem, such as the Smart Siddur. Is there a difference between text-based applications and graphics based? I would think that the same engine renders the text in both cases. I suppose I could split up the string and place the vowels separately, but that seems pretty painful and not extensible.
TIA for any clues.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:18:42+00:00Added an answer on June 15, 2026 at 3:18 am

    Well, the following works. I still don’t understand why I had to implement it, but this does work…

     package com.lomda.ong2;
    
    import java.util.HashMap;
    
    import android.content.Context;
    import android.graphics.Canvas;
    import android.graphics.Color;
    import android.graphics.Paint;
    import android.graphics.Paint.FontMetricsInt;
    import android.graphics.Typeface;
    import android.graphics.Paint.Align;
    import android.graphics.Paint.FontMetrics;
    import android.graphics.Point;
    import android.graphics.Rect;
    import android.util.Log;
    
    // render Hebrew strings with diacritic marks
    // 
    public class HebRender {
    
    Paint paint;
    HashMap<String, Integer> spaces;
    String charString;
    String prevChar = "";
    final String TAG = "HebRender";
    
    public HebRender(Context svContext){
        paint = new Paint(); 
        Typeface t =  Typeface.createFromAsset(svContext.getAssets(),"fonts/SimpleCLM-Bold.ttf");
        //Typeface t =  Typeface.createFromAsset(svContext.getAssets(),"fonts/gisha.ttf");
        paint.setTypeface(t);
        paint.setStyle(Paint.Style.FILL); 
        paint.setTextSize(48); 
        paint.setAntiAlias(true); 
        paint.setTypeface(Typeface.DEFAULT_BOLD); 
        paint.setTextAlign(Align.CENTER);
    }
    
    public void drawText(   Canvas canvas, String word, Point locate, int color) {
        Rect bounds = new Rect();
        Rect prevBounds = new Rect(0,0,0,0);
        paint.getTextBounds(word, 0, word.length(), bounds);
        paint.setColor(color);
        int wordWidth = bounds.width();
        // move to right edge (parameter is center)
        locate.x += wordWidth/2;
        // initialize bounds of individual characters
        bounds = new Rect(0,0,0,0);
        // for each character
        for (int i = 0; i < word.length(); i++) {
            // locate and write letter
            char c = word.charAt(i);
            charString = String.valueOf(c); 
            if (c >= 1488 && c <=1514) {// is in consonant range
                paint.getTextBounds(charString, 0, charString.length(), bounds); // get current char dimensions
                if (!prevChar.equals("")) {
                    int moveOver = bounds.width()/2 + prevBounds.width()/2 + (int) paint.getTextSize()/10;
                    locate.x -= moveOver;
                }
                Log.d(TAG, String.format("Char: %s, Prev char width: %d, char width: %d", charString, prevBounds.width(), bounds.width()));
                canvas.drawText(charString, locate.x, locate.y, paint);
                prevChar = charString;
                prevBounds.set(bounds); // save previous dimensions
            } else {// for each diacritic locate and write
                canvas.drawText(charString, locate.x + getOffset(c, bounds.width()), locate.y, paint);
            }
    
        }
    }
    
    // some diacritic marks need to be moved 
    private int getOffset(char c, int charWidth) {
        int offset = 0;
        switch (c){
        case 0x05C1:  // shin dot
            offset = charWidth/2;
            break;
        case 0x05C2:  // sin dot
            offset = -charWidth/2;
            break;
        case 0x05BC:  // dagesh
            offset = findDagesh(c, charWidth);
            break;
        case 0x05B9: // holam
            offset = -(3*charWidth/5);
            break;
        }
        return offset;
    }
    
    // move dagesh around for certain characters
    private int findDagesh(char c, int charWidth) {
        int offset = 0;
        if (prevChar.equals("ג")) {
            offset = Math.min(2, -charWidth/3);
        } else if (prevChar.equals("ו") ||prevChar.equals("ז") || prevChar.equals("י")){
            offset = Math.min(7, -7*charWidth/10);
        } else if (prevChar.equals("ע") || prevChar.equals("ש") ) {
            offset = Math.max(1, charWidth/3);
        } else if (prevChar.equals("פ")){
            offset = Math.max(2, charWidth/3);
        }
        return offset;
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display hebrew text on the screen using the text command in
I want display error message in my view home.jsp using <c:out value=${message} /> .
I want to display a subtitle text, running over the top of an image,
I am getting Arabic text from server successfully. Retrieved text I want display in
I want to display some text in UIWebView with boxes that can be expanded
I am new to sencha touch2. i want to display some text labels below
I want display Google maps in the Android Based on the user edit text
I have function where I want display a number in text. if (all >
I want display data from database in Listbox...Here is my code, It is not
i want display 1 record from colums zodys , I'm programint in C# I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.