Here you can find the source of shiftHorizontally(int inkX, int inkXWidth, int textWidth)
Parameter | Description |
---|---|
inkX | the left bearing of the rendered text |
inkXWidth | the horizontal width of the rendered text |
textWidth | The width of the rendered label |
public static int shiftHorizontally(int inkX, int inkXWidth, int textWidth)
//package com.java2s; //License from project: Open Source License public class Main { /**//w ww . ja v a 2 s. c o m * Returns a shift of 'x' coordinate in pixels in order to fit the logical extent horizontally * @param inkX the left bearing of the rendered text * @param inkXWidth the horizontal width of the rendered text * @param textWidth The width of the rendered label * @return */ public static int shiftHorizontally(int inkX, int inkXWidth, int textWidth) { if ((inkX < 0) && (inkXWidth <= textWidth)) { return inkX; } if ((inkX + inkXWidth > textWidth) && (inkXWidth <= textWidth)) { return (inkX + inkXWidth - textWidth); } return 0; } }