Java 类com.lowagie.text.pdf.hyphenation.Hyphenation 实例源码

项目:itext2    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:DroidText    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteArchive    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}
项目:MesquiteCore    文件:HyphenationAuto.java   
/** Hyphenates a word and returns the first part of it. To get
 * the second part of the hyphenated word call <CODE>getHyphenatedWordPost()</CODE>.
 * @param word the word to hyphenate
 * @param font the font used by this word
 * @param fontSize the font size used by this word
 * @param remainingWidth the width available to fit this word in
 * @return the first part of the hyphenated word including
 * the hyphen symbol, if any
 */    
public String getHyphenatedWordPre(String word, BaseFont font, float fontSize, float remainingWidth) {
    post = word;
    String hyphen = getHyphenSymbol();
    float hyphenWidth = font.getWidthPoint(hyphen, fontSize);
    if (hyphenWidth > remainingWidth)
        return "";
    Hyphenation hyphenation = hyphenator.hyphenate(word);
    if (hyphenation == null) {
        return "";
    }
    int len = hyphenation.length();
    int k;
    for (k = 0; k < len; ++k) {
        if (font.getWidthPoint(hyphenation.getPreHyphenText(k), fontSize) + hyphenWidth > remainingWidth)
            break;
    }
    --k;
    if (k < 0)
        return "";
    post = hyphenation.getPostHyphenText(k);
    return hyphenation.getPreHyphenText(k) + hyphen;
}