コード例 #1
0
 /*
  * (non-Javadoc)
  * @see
  * org.lobobrowser.html.renderstate.AbstractMarginRenderState#getDefaultMarginInsets
  * ()
  */
 @Override
 protected HtmlInsets getDefaultMarginInsets() {
   HtmlInsets insets = new HtmlInsets();
   RenderState prevRS = this.getPreviousRenderState();
   FontMetrics fm = prevRS == null ? this.getFontMetrics() : prevRS.getFontMetrics();
   insets.top = fm.getHeight();
   insets.bottom = fm.getHeight();
   insets.topType = HtmlInsets.TYPE_PIXELS;
   insets.bottomType = HtmlInsets.TYPE_PIXELS;
   int dpi =
       GraphicsEnvironment.isHeadless() ? 72 : Toolkit.getDefaultToolkit().getScreenResolution();
   insets.left = (int) Math.round((dpi * 30.0) / 72.0);
   insets.right = insets.left / 2;
   insets.leftType = HtmlInsets.TYPE_PIXELS;
   insets.rightType = HtmlInsets.TYPE_PIXELS;
   return insets;
 }