How to find string length in pixels

Hi,
I have a string "lucida bright regular". How can I get size of text in pixels.
Can java.awt.Font work.
An example wil really help.
Thanks
with regards

Not exactly.
I am applying font on text at web server using java
and sending the resulting html to client end where
is is displayed.
Client can not change the
font of that text.
In that case you don't know the capabilities of modern browsers...
Just because you want something bad enough doesn't make it happen.
This is NOT Oz, this is the real world (or what passes for it for lack of alternatives).

Similar Messages

  • How to find the length of the resultset

    how to find the length of the resultset

    (Doing a select count as somebody suggested is nota
    good solution, as the count can change betweenyour
    count query and your real query.)And the number of rows can't change between getting
    the last one and doing the actual work?I don't think so. Once you've got the ResultSet, I don't think it will change under you, unless you explicitly set it to SCROLL_SENSITIVE.
    I could be mistaken though.

  • How I find color of the pixel on the screen?, How I find color of the pixel on the screen?

    How I find color of the pixel on the screen?, How I find color of the pixel on the screen?

    DigitalColor Meter, in your Applications/Utilities folder.
    Regards.

  • How to Find the length of Infosource?/

    Hi BW Guru's,
    How to Find the length of Infosource?
    Thanks
    Bhima Chandra Sekhar G

    Hi Bhima,
    You can look up the transfer structure (extract structure) in table ROOSOURCE in the active version of the DataSource and determine its size via SE11 (DDIC) -> Utilities -> Runtime object -> Table length.
    Hope it helps!
    Bye,
    ROberto

  • SAP script command for finding string length

    Hi ,
    Can anyone please let me know what is the equivalent command  to strlen() in sap script editor. I need to find the string length of a symbol in sap script editor itself without writing the logic in print program or by calling any includes in the sap script editor.
    Regards,
    Deepthi

    Hi Deepthi,
    As an alternative, you can use the perform statement in SAPscript so that it will execute a subroutine you implemented in another report.In the subroutine, you can do everything you want.
    Have a look at this link to find out how exactly.
    http://help.sap.com/saphelp_40b/helpdata/en/d1/803279454211d189710000e8322d00/content.htm
    Best regards,
    George

  • String Length in Pixel

    Hallo, I'd like to know how to compute
    pixel length of a string without any context using Java 1.3.
    In Java 1.2 I used Toolkit, but not more supported.
    Who can help me?
    Thanx.

    Look at the FontMetrics

  • How to find string with trailing space

    Hi,
    I need to search a word instead of string from another string.
    I tried below code and expected that FIND will not search 'weeds' but it seems FIND ignores trailing spaces of string zstr and thus finds word 'weeds'.
    DATA: zstr type string value 'we ',
              lv_string type string value 'These are weeds',
              result_tab TYPE match_result_tab.
    FIND FIRST OCCURRENCE OF regex zstr IN lv_string
                          IGNORING CASE
                          RESULTS result_tab.
    Please consider that zstr is runtime variable with no fixed length.
    If anybody has the solution, reply back fast !
    Regards,
    Sourabh

    Hi,
    Hi,
      DATA STRING(30) VALUE 'This is a little sentence.'.
    WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
    ULINE /1(26).
    SEARCH STRING FOR 'X'.
    WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC',
                   SY-FDPOS UNDER 'SY-FDPOS'
    SEARCH STRING FOR 'itt '.
    WRITE: / 'itt   ', SY-SUBRC UNDER 'SY-SUBRC',
                       SY-FDPOS UNDER 'SY-FDPOS'
    SEARCH STRING FOR '.e .'.
    WRITE: / '.e .', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SEARCH STRING FOR '*e'.
    WRITE: / '*e ', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    SEARCH STRING FOR 's*'.
    WRITE: / 's* ', SY-SUBRC UNDER 'SY-SUBRC',
    SY-FDPOS UNDER 'SY-FDPOS'.
    Hope it will solve your problem..
    Pls. reward if useful...

  • How to find string range

    Say i have a string array from aa0 to aa100. Now how do i write a condition to check that this string lies between aa0 to aa100. please help

    This is the code what i have typed. Its working but when i enter a value which is less then 0 and greater than 99, it still works, where as it shouldnt. Please help
        public void focusLost(FocusEvent evt) {
                    if(evt.getSource() == mytextfield) {
                  System.out.println("Inside focuslost");
                  String text = mytextfield.getText();
                  if(text.startsWith("aa")) {
                       int value;
                       try {
                            value = Integer.parseInt(String.valueOf(text.charAt(text.length() - 1)));
                       }catch(NumberFormatException nfe) {JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);return;}
                       if(value < 0 || value > 99) {
                            System.out.println("Inside if condition");
                            JOptionPane.showMessageDialog(null,"textfield should be \n in the range of aa0 - aa99","Test",JOptionPane.ERROR_MESSAGE);
                            mytextfield.transferFocus();
                            return;
                  else {
                        JOptionPane.showMessageDialog(null,"Invalid entry","Test",JOptionPane.ERROR_MESSAGE);
                        return;
        }

  • How to find string contain.

    Dear all,
    i want to find some char from a given string like below example
    vtext = PM-BGM12_AC :
    if vtext contain '_AC'  then i have to assinge btext = ' Air Conditioner'.
    if vtext = PM-BGM12_BPI  contain '_BPI',
    then i have to assign btext = ' Building & Permanent Improvement '
    i m consfuse what to user ca , co, cs, cp.
    *********point is assured *********

    hi,
    chk out this
    <b><b>CO</b></b> Contains Only:  True, if operand1 only contains characters from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand2 is of type string and is initial, then the logical expression is false, unless operand1 is also of type string and is initial, in which case the logical expression is always true. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1, that is not contained in operand2. If the result of the comparison is positive, sy-fdpos contains the length of operand1.
    <b>CN</b> Contains Not Only; True if a logical expression with CO is false, that is, if operand1 contains not only characters from operand2. sy-fdpos is set in the same way as for CO. If the comparison is true, sy-fdpos contains the offset of the first character in operand1 that is not contained in operand2. If the comparison is false, sy-fdpos contains the length of operand1.
    CA Contains Any: True, if operand1 contains at least one character from operand2. Upper/lower case and trailing blanks are taken into account for both operands. If operand1 or operand2 is of type string and initial, the logical expression is always false. If result of the comparison is positive, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NA</b> Contains Not Any: True if a logical expression with CA is false, that is if operand1 does not contain any characters from operand2. If the result of the comparison is negative, sy-fdpos contains the offset of the first character in operand1 that is also contained in operand2. If the result of the comparison is true, sy-fdpos contains the le of operand1.
    CS Contains String: True if the content of operand2 is contained in operand1. Upper/lower case is not taken into account, trailing blanks of the left operand are taken into account. If operand1 is of type string and initial, or of type c and contains only blank characters, the logical expression is false, unless operand2 is also of type string and initial, or of type c and only contains blank characters. In this case the logical expression is always true. If the result of the comparison is true, sy-fdpos contains the offset of operand2 in operand1. If the result of the comparison is negative, sy-fdpos contains the length of operand1.
    <b>NS</b> Contains No String: True, if a logical expression with CS is false, that is if operand1 does not contain the content of operand2. If the result of the comparison is negative, sy-fdpos contains the offset of operand2. If the comparison is true, sy-fdpos contains the length of operand1.
    <b>CP</b> Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand2 pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1. You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    <b>NP</b> No Pattern: True, if a logical expression with CP is false, that is, if operand1 does not fit the pattern operand2. If the comparison is false, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "*" in operand2 are ignored if operand2 also contains other characters. If the comparison is true, sy-fdpos contains the length of operand1.
    thanks
    jaideep
    *reaward points if useful..

  • How to find String associated with some long value.

    My requirement is to know the String associated with the long value, for ex 23423423 is having some value like 'skljflsjf'. Can any body findout soln for the same.
    Thanks
    ~ Chethangowda.

    My requirement is to know the String associatedwith
    the long value, for ex 23423423 is having somevalue
    like 'skljflsjf'. Can any body findout soln forthe
    same.
    Hum... I'm not 100% sure, but it seems the answeris:
    dgjldkgjfkljg
    Please, don't thank me before you confirm thething.
    Regards.Oooohhhh! That explains it! I guess I must've missed
    the part where he said he wants it translated to
    trollish. How stupid of me.You're absolutely not to blame... to be honest, if I had not read the OP 3-4 times carefully, I would not have found the solution.

  • How to find length of a string in JSF using EL expressions.

    I am doing it as below for finding string length
    <c:set var="test" value="#{myPageBean.myMethod.length()}" />
    While evaluating the above expression,it will call getMyMethod() which will return a String. On that it will call length().
    But it this throwing parsing error,
    Is it different in JSF?..Pls help.

    BabuKhan wrote:
    I have imported the taglib in th below 3 ways and tried
    1. <anyxmlelement xmlns:fn="http://java.sun.com/jsp/jstl/functions" />
    2. <anyxmlelement xmlns:fn="http://java.sun.com/jstl/functions" />
    3. <anyxmlelement xmlns:fn="http://java.sun.com/jsf/functions" />
    Literally? Do you understand the meaning of "anyxmlelement" ?

  • How to find number of characters in a character string

    Hi,
      Can anyone please tell me about how to find the number of characters in a character string type variable.
    Reagards,
    Siva

    hi,
    Use STRLEN for Calculating String Length..
    Assign it to integer variable for Further Use.Suppse u need to find string length for "hai".. this piece of code will help u
    data:  var type string value 'hai',
             len type i.
    len = strlen(var).
    write len.

  • Length in pixels of a string in J++

    Hi,
    This is probably very simple but I can�t figure out how to get the length in pixels of a string.
    The length function just returns the amount of characters!
    i.e.     String temp = �Nick�;
         int len = temp.length;
    len would equal 4.
    Thanks in advance
    Boomah

    It may or may not be simple since you use J++.
    In Java it would go getFontMetrics().getStringWidth("string") (assuming you work with a class that extends some component class)

  • Calculating string length

    hi experts,
    How to calculate string length from driver program. Is there any function module to do it. Please help me. In my application, i will get the input from user and calculate string length and process it. Please help me.

    Hi,
    <<removed>>
    Umang Mehta
    Edited by: kishan P on Oct 9, 2010 3:42 PM

  • How to get Length in pixel of a String in j2ee??

    Hi guys, im having a problem trying to find out how to get pixels from a string length, but in j2ee, i've researched, but everyone said to use Graphics2D, but since im using j2ee, i dont know how to use this.
    For example i found this piece of code, but this doesnt work for me:
    public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    Font font = new Font("Serif", Font.PLAIN, 12);
    FontMetrics fontMetrics = g2d.getFontMetrics();
    int width = fontMetrics.stringWidth("aString");
    int height = fontMetrics.getHeight();
    How to get g2d, if i dont have a graphics to send it to the method??
    I would be really happy if anyone could send me a example using a javabean.
    How to do this guys???? please help me with this guys,thanks.
    yellr

    im working on a good explanation for this question, im trying to send pics of my programso you understand me pretty well. But a general idea, its im creating dynamically components, like labels, textFields, dropDowns, etc. My problem comes when im adding to form the labels, these labels are going to show the descripcion of the component, which it could be a textField, dropDown, textArea etc.
    I put all these components on a gridPanel, for each row i can have severals componets,
    I have a gridPanelGeneral which have all other gridPanels, this gridPanelGeneral have gridPanelRow+"numRow"
    This gridPanelRow+"numRow" can have severals components which show like columns.
    Sincerely i would like to put pictures of the program, so that way you will understand my problem, i need to set the label.setStyle(width:"+numPixelesOfDescriptionOfComponent+"px). To put these labels well, because the user cant see very well the description of the component when i have severals components, each component does have a label for its description. descriptionOfComponent is a string thats why i need to get the pixels of the string.
    One question, how do i do put pics on this forum??
    Edited by: yellr on Oct 30, 2007 9:56 AM

Maybe you are looking for

  • Solution Manager 4.0 - MSCS Installation

    Hi All, We are planning for Solman 4.0 Installation in Cluster environment with Windows 2003 server and MS SQL Server 2005. I have some queries related to this task. 1. Is it possible to install Central Instance in first MSCS node and Database Instan

  • How to remove save, cancel option when end user runs the workbook in Portal

    Hi, how to remove save, cancel option when end user runs the workbook and make some small changes like using page items or increasing rows and columns I already made 2 changes 1) I removed the option in Oracle Enterprise Manager under discoverer view

  • Ipad ios 4.2 Problem (21)

    So i synced my ipad to my computer and at first it wouldn't update to ios 4.2 but i eventually got it to update. i then started to organize all my apps into folders and i was playing with the multitasking when it showed the itunes logo and the usb co

  • Remember When?  Pitfalls of reinstalling FCP 4.5

    I primarily edit for personal use and pleasure, not for a living. I'm one of those who has a system that has worked for me and I've stuck with it. But, now, a problem has developed that requires attention. I can no longer capture footage. My FCP syst

  • Best format to render timelineas

    Hi, I am relatively new to video, having worked in audio for some time. I am wondering what everyone has found to be the best format to render your timeline to, before importing to Encore. I normally have two or three timelines, and expect it's best