当前位置: 首页>>代码示例>>Java>>正文


Java BoundingBox.getLowerLeftY方法代码示例

本文整理汇总了Java中org.apache.fontbox.util.BoundingBox.getLowerLeftY方法的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox.getLowerLeftY方法的具体用法?Java BoundingBox.getLowerLeftY怎么用?Java BoundingBox.getLowerLeftY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.fontbox.util.BoundingBox的用法示例。


在下文中一共展示了BoundingBox.getLowerLeftY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeBoundingBox

import org.apache.fontbox.util.BoundingBox; //导入方法依赖的package包/类
/**
 * Computes the bounding box from given Rectangle2D in device space units.
 * 
 * @param rect
 *          the chars string.
 * @param font
 *          the current font.
 * @param trm
 *          the current text rendering matrix.
 * @return the bounding box from given char string.
 */
protected Rectangle computeBoundingBox(BoundingBox rect, PDFont font,
    Matrix trm) {
  if (rect != null && font != null) {
    Matrix fontMatrix = font.getFontMatrix();
    
    Point ll = new SimplePoint(rect.getLowerLeftX(), rect.getLowerLeftY());
    Point ur = new SimplePoint(rect.getUpperRightX(), rect.getUpperRightY());

    // glyph space -> text space
    transform(ll, fontMatrix);
    transform(ur, fontMatrix);

    // text space -> device space
    transform(ll, trm);
    transform(ur, trm);
    
    return new SimpleRectangle(ll, ur);
  }
  return null;
}
 
开发者ID:ckorzen,项目名称:icecite,代码行数:32,代码来源:PdfTextStreamEngine.java

示例2: getBoundingBoxDescent

import org.apache.fontbox.util.BoundingBox; //导入方法依赖的package包/类
public static float getBoundingBoxDescent(PDFont font, float fontSize) {
    try {
        BoundingBox bBox = font.getBoundingBox();
        float boxDescent = bBox.getLowerLeftY();
        return (boxDescent / 1000) * fontSize;
    } catch (IOException e) {
        // fall through
    }
    return 0.0f;
}
 
开发者ID:TekstoSense,项目名称:pdf-segmenter,代码行数:11,代码来源:Text.java

示例3: writeString

import org.apache.fontbox.util.BoundingBox; //导入方法依赖的package包/类
@Override
protected void writeString(String text, List<TextPosition> textPositions) throws IOException {
    text = text.toLowerCase();
    int index = text.indexOf(mTextToHighlight);
    if (index != -1) {
        PDPage currentPage = getCurrentPage();
        PDRectangle pageBoundingBox = currentPage.getBBox();
        AffineTransform flip = new AffineTransform();
        flip.translate(0, pageBoundingBox.getHeight());
        flip.scale(1, -1);
        PDRectangle mediaBox = currentPage.getMediaBox();
        float mediaHeight = mediaBox.getHeight();
        float mediaWidth = mediaBox.getWidth();
        int size = textPositions.size();
        while (index != -1) {
            int last = index + mTextToHighlight.length() - 1;
            for (int i = index; i <= last; i++) {
                TextPosition pos = textPositions.get(i);
                PDFont font = pos.getFont();
                BoundingBox bbox = font.getBoundingBox();
                Rectangle2D.Float rect = new Rectangle2D.Float(0, bbox.getLowerLeftY(), font.getWidth(pos.getCharacterCodes()[0]), bbox.getHeight());
                AffineTransform at = pos.getTextMatrix().createAffineTransform();
                if (font instanceof PDType3Font) {
                    at.concatenate(font.getFontMatrix().createAffineTransform());
                } else {
                    at.scale(1 / 1000f, 1 / 1000f);
                }
                Shape shape = flip.createTransformedShape(at.createTransformedShape(rect));
                AffineTransform transform = mGC.getTransform();
                int rotation = currentPage.getRotation();
                if (rotation != 0) {
                    switch (rotation) {
                        case 90:
                            mGC.translate(mediaHeight, 0);
                            break;
                        case 270:
                            mGC.translate(0, mediaWidth);
                            break;
                        case 180:
                            mGC.translate(mediaWidth, mediaHeight);
                            break;
                        default:
                            break;
                    }
                    mGC.rotate(Math.toRadians(rotation));
                }
                mGC.fill(shape);
                if (rotation != 0) {
                    mGC.setTransform(transform);
                }
            }
            index = last < size - 1 ? text.indexOf(mTextToHighlight, last + 1) : -1;
        }
    }
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:56,代码来源:PdfRenderer.java

示例4: getBoundingBoxDescent

import org.apache.fontbox.util.BoundingBox; //导入方法依赖的package包/类
public static float getBoundingBoxDescent(PDFont font, float fontSize)
{
    try
    {
        BoundingBox bBox = font.getBoundingBox();
        float boxDescent = bBox.getLowerLeftY();
        return (boxDescent / 1000) * fontSize;
    } catch (IOException e) {
    }
    return 0.0f;
}
 
开发者ID:radkovo,项目名称:Pdf2Dom,代码行数:12,代码来源:TextMetrics.java


注:本文中的org.apache.fontbox.util.BoundingBox.getLowerLeftY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。