Example usage for android.graphics Paint setTypeface

List of usage examples for android.graphics Paint setTypeface

Introduction

In this page you can find the example usage for android.graphics Paint setTypeface.

Prototype

public Typeface setTypeface(Typeface typeface) 

Source Link

Document

Set or clear the typeface object.

Usage

From source file:github.bewantbe.audio_analyzer_for_android.AnalyzeActivity.java

@SuppressWarnings("deprecation")
private void setTextViewFontSize() {
    TextView tv = (TextView) findViewById(R.id.textview_cur);
    // At this point tv.getWidth(), tv.getLineCount() will return 0

    Paint mTestPaint = new Paint();
    mTestPaint.setTextSize(tv.getTextSize());
    mTestPaint.setTypeface(Typeface.MONOSPACE);

    final String text = getString(R.string.textview_peak_text);
    Display display = getWindowManager().getDefaultDisplay();

    // pixels left
    float px = display.getWidth() - getResources().getDimension(R.dimen.textview_RMS_layout_width) - 5;

    float fs = tv.getTextSize(); // size in pixel
    while (mTestPaint.measureText(text) > px && fs > 5) {
        fs -= 0.5;//from w ww.jav  a2  s  .  c  o  m
        mTestPaint.setTextSize(fs);
    }
    ((TextView) findViewById(R.id.textview_cur)).setTextSize(fs / DPRatio);
    ((TextView) findViewById(R.id.textview_peak)).setTextSize(fs / DPRatio);
}

From source file:com.olacabs.customer.ui.TrackRideActivity.java

private Bitmap m13911a(int i, String str) {
    int i2 = 50;/*from w  w  w  .  j  ava2 s .c  o  m*/
    Typeface createFromAsset = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    int i3 = (int) getResources().getDisplayMetrics().scaledDensity;
    int i4 = i3 * 60;
    int i5 = i3 * 76;
    Config config = Config.ARGB_8888;
    if (i4 <= 0) {
        i4 = 50;
    }
    if (i5 > 0) {
        i2 = i5;
    }
    Bitmap createScaledBitmap = Bitmap
            .createScaledBitmap(BitmapFactoryInstrumentation.decodeResource(getResources(), i), i4, i2, true);
    Canvas canvas = new Canvas(createScaledBitmap);
    float f = (float) (i4 / 2);
    float f2 = (float) (i4 / 2);
    Paint paint = new Paint(1);
    paint.setColor(Color.parseColor("#d4db28"));
    paint.setStyle(Style.FILL);
    paint.setTextSize((float) (i3 * 18));
    paint.setTypeface(createFromAsset);
    if (str.length() == 3) {
        canvas.drawText(str, f - ((float) (i3 * 15)), f2, paint);
    } else if (str.length() == 2) {
        canvas.drawText(str, f - ((float) (i3 * 10)), f2, paint);
    } else if (str.length() == 1) {
        canvas.drawText(str, f - ((float) (i3 * 6)), f2, paint);
    }
    paint.setTextSize((float) (i3 * 16));
    canvas.drawText(" min ", f - ((float) (i3 * 18)), f2 + ((float) (i3 * 15)), paint);
    return createScaledBitmap;
}

From source file:com.appeaser.sublimepickerlibrary.timepicker.RadialTimePickerView.java

/**
 * Draw the 12 text values at the positions specified by the textGrid parameters.
 */// ww  w. ja v a  2 s  . co  m
private void drawTextElements(Canvas canvas, float textSize, Typeface typeface, ColorStateList textColor,
        String[] texts, float[] textX, float[] textY, Paint paint, int alpha, boolean showActivated,
        int activatedDegrees, boolean activatedOnly) {
    paint.setTextSize(textSize);
    paint.setTypeface(typeface);

    // The activated index can touch a range of elements.
    final float activatedIndex = activatedDegrees / (360.0f / NUM_POSITIONS);
    final int activatedFloor = (int) activatedIndex;
    final int activatedCeil = ((int) Math.ceil(activatedIndex)) % NUM_POSITIONS;

    for (int i = 0; i < 12; i++) {
        final boolean activated = (activatedFloor == i || activatedCeil == i);
        if (activatedOnly && !activated) {
            continue;
        }

        final int stateMask = SUtils.STATE_ENABLED | (showActivated && activated ? SUtils.STATE_ACTIVATED : 0);
        final int color = textColor.getColorForState(SUtils.resolveStateSet(stateMask), 0);
        paint.setColor(color);
        paint.setAlpha(getMultipliedAlpha(color, alpha));

        canvas.drawText(texts[i], textX[i], textY[i], paint);
    }
}

From source file:org.cryptsecure.Utility.java

/**
 * Cut text into one line.//  ww  w  . j  a  v  a2s  .  c  om
 * 
 * @param text
 *            the text
 * @param maxWidth
 *            the max width
 * @param textSize
 *            the text size
 * @return the string
 */
public static String cutTextIntoOneLine(String text, int maxWidth, int textSize) {
    try {
        Paint paint = new Paint();
        Rect bounds = new Rect();
        int textWidth = 0;
        paint.setTypeface(Typeface.DEFAULT);// your preference here
        paint.setTextSize(textSize);// have this the same as your text size

        String outText = text;
        String outText2 = text;

        boolean modified = false;
        boolean cutDown = false;
        while (true) {
            if (modified) {
                paint.getTextBounds(outText2, 0, outText2.length(), bounds);
            } else {
                paint.getTextBounds(outText, 0, outText.length(), bounds);
            }
            textWidth = bounds.width();
            if (textWidth <= maxWidth) {
                break;
            } else {
                modified = true;
                if (!cutDown) {
                    cutDown = true;
                    int estimatedLen = (outText.length() * maxWidth) / textWidth;
                    estimatedLen += 20; // be carefull!
                    if (estimatedLen > outText.length()) {
                        estimatedLen = outText.length();
                    }
                    outText = outText.substring(0, estimatedLen);
                    outText2 = outText + "...";
                } else {
                    // reduce by one character
                    outText = outText.substring(0, outText.length() - 1);
                    outText2 = outText + "...";
                }
            }
        }
        if (modified) {
            return outText2;
        } else {
            return outText;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}

From source file:com.tr4android.support.extension.picker.time.RadialTimePickerView.java

/**
 * Draw the 12 text values at the positions specified by the textGrid parameters.
 *///from  w  ww.  j a v  a  2 s  . com
private void drawTextElements(Canvas canvas, float textSize, Typeface typeface, ColorStateList textColor,
        String[] texts, float[] textX, float[] textY, Paint paint, int alpha, boolean showActivated,
        int activatedDegrees, boolean activatedOnly) {
    paint.setTextSize(textSize);
    paint.setTypeface(typeface);

    // The activated index can touch a range of elements.
    final float activatedIndex = activatedDegrees / (360.0f / NUM_POSITIONS);
    final int activatedFloor = (int) activatedIndex;
    final int activatedCeil = ((int) Math.ceil(activatedIndex)) % NUM_POSITIONS;

    for (int i = 0; i < 12; i++) {
        final boolean activated = (activatedFloor == i || activatedCeil == i);
        if (activatedOnly && !activated) {
            continue;
        }

        final int[] stateMask = new int[] { android.R.attr.state_enabled,
                (showActivated && activated ? android.R.attr.state_selected : 0) };
        final int color = textColor.getColorForState(stateMask, 0);
        paint.setColor(color);
        paint.setAlpha(getMultipliedAlpha(color, alpha));

        canvas.drawText(texts[i], textX[i], textY[i], paint);
    }
}

From source file:net.droidsolutions.droidcharts.core.renderer.xy.AbstractXYItemRenderer.java

/**
 * Draws a horizontal line across the chart to represent a 'range marker'.
 *
 * @param g2  the graphics device.//from www.  j  a v a  2s .  co m
 * @param plot  the plot.
 * @param rangeAxis  the range axis.
 * @param marker  the marker line.
 * @param dataArea  the axis data area.
 */
public void drawRangeMarker(Canvas g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) {

    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = rangeAxis.getRange();
        if (!range.contains(value)) {
            return;
        }

        double v = rangeAxis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
        PlotOrientation orientation = plot.getOrientation();
        Line2D line = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
        } else if (orientation == PlotOrientation.VERTICAL) {
            line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
        }

        Paint oPiant = marker.getPaint();
        oPiant.setStyle(Paint.Style.STROKE);
        int oOldAlpha = oPiant.getAlpha();
        oPiant.setAlpha(marker.getAlpha());
        oPiant.setStrokeWidth(marker.getStroke());
        g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(), (float) line.getY2(),
                oPiant);
        oPiant.setAlpha(oOldAlpha);
        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();
            Paint paint = marker.getLabelPaint();
            paint.setTypeface(labelFont.getTypeFace());
            paint.setTextSize(labelFont.getSize());
            Point2D coordinates = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea,
                    line.getBounds2D(), marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor);
            TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(),
                    marker.getLabelTextAnchor(), paint);
        }

    } else if (marker instanceof IntervalMarker) {
        IntervalMarker im = (IntervalMarker) marker;
        double start = im.getStartValue();
        double end = im.getEndValue();
        Range range = rangeAxis.getRange();
        if (!(range.intersects(start, end))) {
            return;
        }

        double start2d = rangeAxis.valueToJava2D(start, dataArea, plot.getRangeAxisEdge());
        double end2d = rangeAxis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
        double low = Math.min(start2d, end2d);
        double high = Math.max(start2d, end2d);

        PlotOrientation orientation = plot.getOrientation();
        Rectangle2D rect = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            // clip left and right bounds to data area
            low = Math.max(low, dataArea.getMinX());
            high = Math.min(high, dataArea.getMaxX());
            rect = new Rectangle2D.Double(low, dataArea.getMinY(), high - low, dataArea.getHeight());
        } else if (orientation == PlotOrientation.VERTICAL) {
            // clip top and bottom bounds to data area
            low = Math.max(low, dataArea.getMinY());
            high = Math.min(high, dataArea.getMaxY());
            rect = new Rectangle2D.Double(dataArea.getMinX(), low, dataArea.getWidth(), high - low);
        }

        Paint p = marker.getPaint();
        int oldAlpha = p.getAlpha();
        p.setAlpha(marker.getAlpha());
        p.setStyle(Paint.Style.FILL);

        g2.drawRect((float) rect.getMinX(), (float) rect.getMinY(), (float) rect.getMaxX(),
                (float) rect.getMaxY(), p);
        p.setAlpha(oldAlpha);

        // now draw the outlines, if visible...
        if (im.getOutlinePaint() != null && im.getOutlineStroke() != null) {
            if (orientation == PlotOrientation.VERTICAL) {
                Line2D line = new Line2D.Double();
                double x0 = dataArea.getMinX();
                double x1 = dataArea.getMaxX();
                Paint oPiant = im.getOutlinePaint();
                oPiant.setStyle(Paint.Style.STROKE);
                int oOldAlpha = oPiant.getAlpha();
                oPiant.setAlpha(marker.getAlpha());
                oPiant.setStrokeWidth(im.getOutlineStroke());
                if (range.contains(start)) {
                    line.setLine(x0, start2d, x1, start2d);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                if (range.contains(end)) {
                    line.setLine(x0, end2d, x1, end2d);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                oPiant.setAlpha(oOldAlpha);
            } else { // PlotOrientation.HORIZONTAL
                Line2D line = new Line2D.Double();
                double y0 = dataArea.getMinY();
                double y1 = dataArea.getMaxY();
                Paint oPiant = im.getOutlinePaint();
                oPiant.setStyle(Paint.Style.STROKE);
                int oOldAlpha = oPiant.getAlpha();
                oPiant.setAlpha(marker.getAlpha());
                oPiant.setStrokeWidth(im.getOutlineStroke());
                if (range.contains(start)) {
                    line.setLine(start2d, y0, start2d, y1);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                if (range.contains(end)) {
                    line.setLine(end2d, y0, end2d, y1);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                oPiant.setAlpha(oOldAlpha);
            }
        }

        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();

            Paint paint = marker.getLabelPaint();
            paint.setTypeface(labelFont.getTypeFace());
            paint.setTextSize(labelFont.getSize());
            Point2D coordinates = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, rect,
                    marker.getLabelOffset(), marker.getLabelOffsetType(), anchor);
            TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(),
                    marker.getLabelTextAnchor(), paint);
        }
    }
}

From source file:net.droidsolutions.droidcharts.core.renderer.xy.AbstractXYItemRenderer.java

/**
 * Draws a vertical line on the chart to represent a 'range marker'.
 *
 * @param g2  the graphics device.//from   w  ww .j a va 2  s .  c  o  m
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param marker  the marker line.
 * @param dataArea  the axis data area.
 */
public void drawDomainMarker(Canvas g2, XYPlot plot, ValueAxis domainAxis, Marker marker,
        Rectangle2D dataArea) {

    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = domainAxis.getRange();
        if (!range.contains(value)) {
            return;
        }

        double v = domainAxis.valueToJava2D(value, dataArea, plot.getDomainAxisEdge());

        PlotOrientation orientation = plot.getOrientation();
        Line2D line = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
        } else if (orientation == PlotOrientation.VERTICAL) {
            line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
        }

        Paint paint = marker.getPaint();
        int oldAlpha = paint.getAlpha();
        paint.setAlpha(marker.getAlpha());
        Float stroke = marker.getStroke();

        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(stroke);

        g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(), (float) line.getY2(),
                paint);

        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();

            Paint lPaint = marker.getLabelPaint();
            lPaint.setTypeface(labelFont.getTypeFace());
            lPaint.setTextSize(labelFont.getSize());
            int lOldAlpha = lPaint.getAlpha();
            lPaint.setAlpha(marker.getAlpha());
            Point2D coordinates = calculateDomainMarkerTextAnchorPoint(g2, orientation, dataArea,
                    line.getBounds2D(), marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor);
            TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(),
                    marker.getLabelTextAnchor(), lPaint);
            lPaint.setAlpha(lOldAlpha);
        }
        paint.setAlpha(oldAlpha);
    } else if (marker instanceof IntervalMarker) {
        IntervalMarker im = (IntervalMarker) marker;
        double start = im.getStartValue();
        double end = im.getEndValue();
        Range range = domainAxis.getRange();
        if (!(range.intersects(start, end))) {
            return;
        }

        double start2d = domainAxis.valueToJava2D(start, dataArea, plot.getDomainAxisEdge());
        double end2d = domainAxis.valueToJava2D(end, dataArea, plot.getDomainAxisEdge());
        double low = Math.min(start2d, end2d);
        double high = Math.max(start2d, end2d);

        PlotOrientation orientation = plot.getOrientation();
        Rectangle2D rect = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            // clip top and bottom bounds to data area
            low = Math.max(low, dataArea.getMinY());
            high = Math.min(high, dataArea.getMaxY());
            rect = new Rectangle2D.Double(dataArea.getMinX(), low, dataArea.getWidth(), high - low);
        } else if (orientation == PlotOrientation.VERTICAL) {
            // clip left and right bounds to data area
            low = Math.max(low, dataArea.getMinX());
            high = Math.min(high, dataArea.getMaxX());
            rect = new Rectangle2D.Double(low, dataArea.getMinY(), high - low, dataArea.getHeight());
        }

        Paint p = marker.getPaint();
        int oldAlpha = p.getAlpha();
        p.setAlpha(marker.getAlpha());
        p.setStyle(Paint.Style.FILL);

        g2.drawRect((float) rect.getMinX(), (float) rect.getMinY(), (float) rect.getMaxX(),
                (float) rect.getMaxY(), p);
        p.setAlpha(oldAlpha);
        // now draw the outlines, if visible...
        if (im.getOutlinePaint() != null && im.getOutlineStroke() != null) {
            if (orientation == PlotOrientation.VERTICAL) {
                Line2D line = new Line2D.Double();
                double y0 = dataArea.getMinY();
                double y1 = dataArea.getMaxY();
                Paint oPiant = im.getOutlinePaint();
                oPiant.setStyle(Paint.Style.STROKE);
                int oOldAlpha = oPiant.getAlpha();
                oPiant.setAlpha(marker.getAlpha());
                oPiant.setStrokeWidth(im.getOutlineStroke());

                if (range.contains(start)) {
                    line.setLine(start2d, y0, start2d, y1);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                if (range.contains(end)) {
                    line.setLine(end2d, y0, end2d, y1);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                oPiant.setAlpha(oOldAlpha);
            } else { // PlotOrientation.HORIZONTAL
                Line2D line = new Line2D.Double();
                double x0 = dataArea.getMinX();
                double x1 = dataArea.getMaxX();
                Paint oPiant = im.getOutlinePaint();
                oPiant.setStyle(Paint.Style.STROKE);
                int oOldAlpha = oPiant.getAlpha();
                oPiant.setAlpha(marker.getAlpha());
                oPiant.setStrokeWidth(im.getOutlineStroke());
                if (range.contains(start)) {
                    line.setLine(x0, start2d, x1, start2d);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                if (range.contains(end)) {
                    line.setLine(x0, end2d, x1, end2d);
                    g2.drawLine((float) line.getX1(), (float) line.getY1(), (float) line.getX2(),
                            (float) line.getY2(), oPiant);
                }
                oPiant.setAlpha(oOldAlpha);
            }
        }

        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();
            Paint paint = marker.getLabelPaint();
            paint.setTypeface(labelFont.getTypeFace());
            paint.setTextSize(labelFont.getSize());
            Point2D coordinates = calculateDomainMarkerTextAnchorPoint(g2, orientation, dataArea, rect,
                    marker.getLabelOffset(), marker.getLabelOffsetType(), anchor);
            TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(),
                    marker.getLabelTextAnchor(), paint);
        }

    }

}

From source file:com.inmobi.ultrapush.AnalyzeActivity.java

@SuppressWarnings("deprecation")
private void setTextViewFontSize() {
    TextView tv = (TextView) findViewById(R.id.textview_cur);
    // At this point tv.getWidth(), tv.getLineCount() will return 0

    Paint mTestPaint = new Paint();
    mTestPaint.setTextSize(tv.getTextSize());
    mTestPaint.setTypeface(Typeface.MONOSPACE);

    final String text = getString(R.string.textview_peak_text);
    Display display = getWindowManager().getDefaultDisplay();

    // pixels left
    float px = display.getWidth() - getResources().getDimension(R.dimen.textview_RMS_layout_width) - 5;

    float fs = tv.getTextSize(); // size in pixel
    while (mTestPaint.measureText(text) > px && fs > 5) {
        fs -= 0.5;/*  w w w .  ja v a  2s  .c o m*/
        mTestPaint.setTextSize(fs);
    }

    ((TextView) findViewById(R.id.textview_cur)).setTextSize(fs / DPRatio);
    ((TextView) findViewById(R.id.textview_peak)).setTextSize(fs / DPRatio);
}

From source file:io.doist.datetimepicker.time.RadialTimePickerView.java

/**
 * Draw the 12 text values at the positions specified by the textGrid parameters.
 *///from   w  w w . ja v a2s.  co  m
private void drawTextElements(Canvas canvas, float textSize, Typeface typeface, String[] texts,
        float[] textGridWidths, float[] textGridHeights, Paint paint, int color, int alpha) {
    paint.setTextSize(textSize);
    paint.setTypeface(typeface);
    paint.setColor(color);
    paint.setAlpha(getMultipliedAlpha(color, alpha));
    canvas.drawText(texts[0], textGridWidths[3], textGridHeights[0], paint);
    canvas.drawText(texts[1], textGridWidths[4], textGridHeights[1], paint);
    canvas.drawText(texts[2], textGridWidths[5], textGridHeights[2], paint);
    canvas.drawText(texts[3], textGridWidths[6], textGridHeights[3], paint);
    canvas.drawText(texts[4], textGridWidths[5], textGridHeights[4], paint);
    canvas.drawText(texts[5], textGridWidths[4], textGridHeights[5], paint);
    canvas.drawText(texts[6], textGridWidths[3], textGridHeights[6], paint);
    canvas.drawText(texts[7], textGridWidths[2], textGridHeights[5], paint);
    canvas.drawText(texts[8], textGridWidths[1], textGridHeights[4], paint);
    canvas.drawText(texts[9], textGridWidths[0], textGridHeights[3], paint);
    canvas.drawText(texts[10], textGridWidths[1], textGridHeights[2], paint);
    canvas.drawText(texts[11], textGridWidths[2], textGridHeights[1], paint);
}

From source file:com.lt.adamlee.aagame.GameView.java

public void help(Canvas c) {
    String x = "";
    float textsize = F.hf(19.0f);
    Paint p4 = new Paint();
    Paint p5 = new Paint();
    Paint p6 = new Paint();
    String text = ctx.getString(R.string.helptext);
    p4.setColor(getResources().getColor(R.color.bright_foreground_inverse_material_light));
    p4.setFlags(1);//from  ww  w  .j  a  va 2  s  .c  o m
    p5.setTypeface(tf);
    p5.setTextSize(F.hf(30.0f));
    p6.setTextSize(textsize);
    p5.setColor(ViewCompat.MEASURED_STATE_MASK);
    c.drawRect(0.0f, 0.0f, (float) screenW, (float) screenH, p4);
    c.drawText(ctx.getString(R.string.help),
            ((float) (screenW / 2)) - (p5.measureText(ctx.getString(R.string.help)) / 2.0f),
            (float) (screenH / 8), p5);
    int i = 0;
    int xv1 = 0;
    int yv1 = (int) textsize;
    while (i < ctx.getString(R.string.helptext).length()) {
        if (text.charAt(i) != '$') {
            c.drawText("  " + ctx.getString(R.string.helptext).charAt(i), (float) xv1,
                    ((float) ((screenH / 8) + yv1)) + (4.0f * textsize), p6);
            xv1 = (int) (((float) xv1)
                    + p6.measureText(Character.toString(ctx.getString(R.string.helptext).charAt(i))));
        }
        if (ctx.getString(R.string.helptext).charAt(i) == '$') {
            i++;
            x = " ";
            yv1 = (int) (((float) yv1) + textsize);
            xv1 = 0;
        }
        i++;
    }
}