Get Pixel Height of Font in IE7

I need to get the pixel height of a line of text with javascript. I've written a gwt method that works in Firefox and Chrome and does ok with IE8. But it doesn't work at all in IE7. My code follows, if anyone knows a solution I'd appreciate it.

public static int getFontHeight() { HTML sizeText = new HTML("Abcdefghij <br/>klmno<br />pqrst<br /> uvwxyz"); sizeText.addStyleName("page"); AbsolutePanel ap = new AbsolutePanel(); ap.setSize("100%", "100%"); ap.add(sizeText, 50, 50); sizeText.getElement().getStyle().setZIndex(-50); RootPanel.get().add(ap); int height = (int) sizeText.getOffsetHeight() / 4; RootPanel.get().remove(ap); if (DetectBrowser.isIE8()) return height + 2; return height; }

Category:javascript Views:0 Time:2010-07-17

Related post

  • line height and font size 2009-09-11

    What sets the height of the textbox, line height or font size? --------------Solutions------------- None its height attribute <input type="text" class="hei" id="txt1" /> <style> .hei { height: 40px; } </style> font-size: Sets or ret

  • How to get Silverlight's bitmapimage pixel height before it is drawn to canvas? 2010-04-20

    I have an Image, which I need to scale based on the image's pixel values. When I create the bitmapImage, the pixels (height and width) are both 0. Is there a way to get height and width before the image is drawn to the canvas? --------------Solutions

  • In IE6 div not taking available height while taking in IE7 and FF? 2010-04-30

    In IE6 div not taking available height while taking in IE7 and FF? height not defined on div In IE6 div taking height according to content inside div while in IE7 and FF div taking full available height --------------Solutions------------- Just based

  • How to increase height of font in pdf 2011-05-30

    I am using the Leaves Example downloaded from github for ebook reader purpose.Is there any solution in that leaves example to increase /decrease height of font of the pdf. Is that possible in leaves example or with some other example .Basically what

  • Get Pixel height of Centimetre unit CSS 2011-07-21

    We're writing our own web app and we need the user to have a (fairly) accurate visualisation of their printed documents on-screen. I'm using the centimetre unit in CSS to try and replicate an A4 page. I need to work out the actual pixel height assign

  • rendered font in IE7 width is bigger than in other borwsers 2011-12-16

    Rendered font in IE7 width is bigger than in other borwsers ( Top image part is IE9, bottom part is Firefox ): The HTML: <div id="header_tools"> <a href="#">Support</a> | <a href="#">FAQs</a> | <a href="#">Sitemap

  • Google Maps pixel height by latitude 2011-12-27

    In Google maps, the closer one gets to the pole, the more strechted out the map gets and sp each pixel of map represents less movment (asymtotically to 0 at the north pole) I'm looking for a formula to connect the width of a pixel in degrees to the l

  • jQuery animate the line-height and font-size 2012-03-28

    I have a div panel wich has font-size of 20 and line-height of 100 px but I want to animate it to have font-size 15 and line-height 50 so the block keeps the font and reduces the height.. here is what I tried $("#homepage_panel").animate({ height: '5

  • my photos need to be 100 pixels width,100 pixel height and file size no more than 15kb 2014-07-31

    photos need to be width 100 pixels,height 100 pixels andthe file size no more than 15kb --------------Solutions------------- photos need to be width 100 pixels,height 100 pixels andthe file size no more than 15kb ============================ I sugges

  • Height calculation differences between IE7 and Firefox/Safari 2011-05-10

    this is driving me crazy...might be something very simple and I just need another set of eyes to look at it... I have this in my CSS: #recipient { width: 31%; text-align: center; min-height: 335px; float: right; background-color: #fff; color: #000; b

  • Estimate pixels of proportional font in SVG or Java 2009-02-12

    Is there an way to estimate the number of pixels used by a proportional font? I am writing software that creates an image in SVG and transform that to PNG in Java. In this image I am using a text with a proportional font (size 16). I can sometimes fi

  • Transform pixel height of image to printing size used by graphics object 2009-04-28

    As part of a print procedure of my application I'm trying to print a list of images scaled down to a specified width and placed one below the other. The problem is I can not figure out how to transform the height in pixels of the images to the height

  • height:100% problem in IE7, not in FF 2010-01-27

    I want to display a page with no scrollbar (height:100%). I have read suggestions to add this argument to html and body. But it does not work as I expect. In FF indeed I do not see a scrollbar. But in IE7 and 8 (Standards mode) there is a scrollbar.

  • Width and height of font 2010-04-05

    How to get the width and height of a specified number of characters, font Size, font type and font style? Examples: font size = 14 <br> font type = "Times New Roman" <br> font style = "Regular"<br> No of Characters = 50<br> Wh

  • table height not 100% in IE7 but it works in FF3.6 2010-06-10

    In this page, the height of the payment method area is shorter than the height of the parent element in IE7. How can I fix this Do I have to apply shading to the parent element - a table cell - instead of the table? This is the page: https://checkout

  • Where we should declare font size, line height and font-family to body, before css reset or after? 2010-06-22

    For example if i'm using eric meyer reset and i have to apply this style to body. body { font: 100%/1.5 "Helvetica Neue", Helvetica, Tahoma, Arial, sans-serif;*/ } should i keep this before reset css or after? html, body, div, span, applet, object, i

  • Can I to specify the width of a table but keeping the height and font size? 2010-06-28

    I want the tables of my report have the same width as the text column but keeping the height according to its content. \rezisebox is not what I need because it rezise the width and the height and change the font size. There's a way to do that? Thanks

  • why different frames height in chrome and IE7 2010-07-11

    i have two frames in one html page, which display correctly in chrome browser.but when i tried in IE7 it just looks very strange,its height is not 100% any more !the below is the code . <iframe src ="demoFramesetLeftFrame.jsp" name="treeframe" id=

  • Sub-pixel rendering of fonts on the iPad 2011-04-10

    Sub-pixel font rendering like ClearType dramatically improves font display resolution and improves screen readability. How would I program sub-pixel rendering of a font (in general), and how can this be achieved on the iPad (C, C++, or Objective-C on

Copyright (C), All Rights Reserved.

processed in 0.099 (s). 11 q(s)