HighlightsView.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
TextLayout createPartTextLayout(int shift, int length) {
    checkTextLayoutValid();
    if (breakInfo == null) {
        breakInfo = new TextLayoutBreakInfo(textLayout.getCharacterCount());
    }
    TextLayout partTextLayout = breakInfo.findPartTextLayout(shift, length);
    if (partTextLayout == null) {
        DocumentView docView = getDocumentView();
        Document doc = docView.getDocument();
        CharSequence docText = DocumentUtilities.getText(doc);
        int startOffset = getStartOffset();
        String text = docText.subSequence(startOffset + shift, startOffset + shift + length).toString();
        if (docView.op.isNonPrintableCharactersVisible()) {
            text = text.replace(' ', DocumentViewOp.PRINTING_SPACE);
        }
        AttributeSet attrs = ViewUtils.getFirstAttributes(getAttributes());
        Font font = ViewUtils.getFont(attrs, docView.op.getDefaultFont());
        partTextLayout = docView.op.createTextLayout(text, font);
        breakInfo.add(shift, length, partTextLayout);
    }
    return partTextLayout;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号