Java Code Examples for sun.font.TextLineComponent#getAdvanceBetween()
The following examples show how to use
sun.font.TextLineComponent#getAdvanceBetween() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextLine.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 2
Source File: TextLine.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 3
Source File: TextLine.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 4
Source File: TextLine.java From hottub with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 5
Source File: TextLine.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 6
Source File: TextLine.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 7
Source File: TextLine.java From Java8CN with Apache License 2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 8
Source File: TextLine.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 9
Source File: TextLine.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 10
Source File: TextLine.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 11
Source File: TextLine.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 12
Source File: TextLine.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit) { float advance = 0; int tlcStart = 0; for(int i = 0; i < components.length; i++) { TextLineComponent comp = components[i]; int tlcLength = comp.getNumCharacters(); int tlcLimit = tlcStart + tlcLength; if (tlcLimit > start) { int measureStart = Math.max(0, start - tlcStart); int measureLimit = Math.min(tlcLength, limit - tlcStart); advance += comp.getAdvanceBetween(measureStart, measureLimit); if (tlcLimit >= limit) { break; } } tlcStart = tlcLimit; } return advance; }
Example 13
Source File: TextMeasurer.java From JDKSourceCode1.8 with MIT License | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 14
Source File: TextMeasurer.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 15
Source File: TextMeasurer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 16
Source File: TextMeasurer.java From Bytecoder with Apache License 2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 17
Source File: TextMeasurer.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 18
Source File: TextMeasurer.java From jdk-1.7-annotated with Apache License 2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 19
Source File: TextMeasurer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }
Example 20
Source File: TextMeasurer.java From hottub with GNU General Public License v2.0 | 4 votes |
private int calcLineBreak(final int pos, final float maxAdvance) { // either of these statements removes the bug: //generateComponents(0, fChars.length); //generateComponents(pos, fChars.length); int startPos = pos; float width = maxAdvance; int tlcIndex; int tlcStart = fComponentStart; for (tlcIndex = 0; tlcIndex < fComponents.length; tlcIndex++) { int gaLimit = tlcStart + fComponents[tlcIndex].getNumCharacters(); if (gaLimit > startPos) { break; } else { tlcStart = gaLimit; } } // tlcStart is now the start of the tlc at tlcIndex for (; tlcIndex < fComponents.length; tlcIndex++) { TextLineComponent tlc = fComponents[tlcIndex]; int numCharsInGa = tlc.getNumCharacters(); int lineBreak = tlc.getLineBreakIndex(startPos - tlcStart, width); if (lineBreak == numCharsInGa && tlcIndex < fComponents.length) { width -= tlc.getAdvanceBetween(startPos - tlcStart, lineBreak); tlcStart += numCharsInGa; startPos = tlcStart; } else { return tlcStart + lineBreak; } } if (fComponentLimit < fChars.length) { // format more text and try again //if (haveLayoutWindow) { // outOfWindow++; //} generateComponents(pos, fChars.length); return calcLineBreak(pos, maxAdvance); } return fChars.length; }