String to bitmap generation

Hi
I try to generate a bmp file. The input data will be a String in Unicode like String s = "Hello world"; The output will be a bmp file of hight and width which will have this text on it. The font used to generate bmp should be also a parameter.
Now my quastion: is it possible to generate this in Java without any additional libraries? WHat kind of package (classes and methods) should I use?
PS: I do not want to convert image to base64 and then send it via net and then this string base64 convert to image.
I just want to have bmp file with black letter "Hello World" and white background.
THX

Thx a lot...I used Your advice and just start some coding..and it worked!
I always thought thst Graphics is dedicated to Swing components...but I was wrong.
For those who want to do same thing thst I was doing some Java code below:
package stringtobitmap;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D;
import javax.imageio.ImageIO;
import java.io.*;
* @author lucjan.lipka
public class StringToImage {
     * @param args the command line arguments
    public static void main(String[] args) {
        // TODO code application logic here
        int width = 200;
        int height = 200;
        // Create buffered image that does not support transparency
        BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = bimage.createGraphics();
        //Draw String on BufferedImage
        g2d.drawString("Java is...amazing", 20, 100);
        //File IO
        File plik = new File("c:/1/test.bmp");
        try {
            //Write BufferedImage on disk
            ImageIO.write(bimage, "bmp", plik);
        } catch (Exception e) {
            System.out.println("error" + e);
}And if You want to know what graphic extensions are accepted :
package stringtobitmap;
* @author lucjan.lipka
import javax.imageio.ImageIO;
public class Formats {
  static public void main(String args[]) throws Exception {
    String names[] = ImageIO.getReaderFormatNames();
    for (int i = 0; i < names.length; ++i) {
      System.out.println("reader " + names);
names = ImageIO.getWriterFormatNames();
for (int i = 0; i < names.length; ++i) {
System.out.println("writer " + names[i]);

Similar Messages

  • How to extract Slide data in 3rd part application from clipboard

    I need to be able to copy/paste or drag/drop from PowerPoint into another application (C# WPF). In my OnDrop method the DragEventArgs Data has these formats:
            [0]    "Preferred DropEffect"    string
            [1]    "InShellDragLoop"    string
            [2]    "PowerPoint 12.0 Internal Slides"    string
            [3]    "ActiveClipBoard"    string
            [4]    "PowerPoint 14.0 Slides Package"    string
            [5]    "Embedded Object"    string
            [6]    "Link Source"    string
            [7]    "Object Descriptor"    string
            [8]    "Link Source Descriptor"    string
            [9]    "PNG"    string
            [10]    "JFIF"    string
            [11]    "GIF"    string
            [12]    "Bitmap"    string
            [13]    "System.Drawing.Bitmap"    string
            [14]    "System.Windows.Media.Imaging.BitmapSource"    string
            [15]    "EnhancedMetafile"    string
            [16]    "System.Drawing.Imaging.Metafile"    string
            [17]    "MetaFilePict"    string
            [18]    "PowerPoint 12.0 Internal Theme"    string
            [19]    "PowerPoint 12.0 Internal Color Scheme"    string
    The "PowerPoint 14.0 Slides Package" is a byte array... can this be converted into Slides?
    If not how would I go about getting high-resolution images + slide text from a drag/drop?
    [Originally posted here: http://answers.microsoft.com/en-us/office/forum/office_2013_release-powerpoint/how-to-extract-slide-data-in-3rd-part-application/a0b5ed64-eb77-49bb-bf44-e0732e23a5eb]

    What I'd like to do:
    Open PowerPoint
    In PPT open a presentation
    In PPT select a slide
    Drag it to my 3rd party WPF application
    In the 3rd party WPF application drop handler get the slide data (text, background image, etc...).
    When I do this I get the DragEventArgs Data (the clipboard data) and it has the 20 supported formats I listed in the 1st post. From these formats #4 seemed like it could have some useful info.
    WPF
    <Window x:Class="PowerPointDropSlide.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" AllowDrop="True" Drop="UIElement_OnDrop" DragOver="UIElement_OnDragOver">
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightBlue">
    <TextBlock Text="Drop something here!"/>
    </Grid>
    </Window>
    Handlers:
    public void UIElement_OnDragOver(object sender, DragEventArgs e)
    public void UIElement_OnDrop(object sender, DragEventArgs e)
    string[] supportedFormats = e.Data.GetFormats();
    object pptSlidesPackage = e.Data.GetData("PowerPoint 14.0 Slides Package");

  • "No Deserializer found" using UTL_DBWS

    Hi guys,
    I've been using web services before, but I just can't set this one up.
    I tried sooo many different combinations in namespaces and such, but the code below still gives
    ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: No Deserializer found to deserialize a 'http://es.tsystems.icam.iit.comunicacioIndirecta.consultarIt.presentacio.webservices/IConsultarItWS.xsd:ns1:usuari' using encoding style 'null'. [java.lang.IllegalArgumentException]
    CREATE OR REPLACE FUNCTION K_TEST RETURN VARCHAR2 AS
    v_WSDL      VARCHAR2(100) := 'https://pre.salut.gencat.net/sic_iit/AppJava/ConsultarItWS?WSDL';
    v_service   UTL_DBWS.SERVICE;
    v_call      UTL_DBWS.CALL;
    v_request   CLOB;
    v_response  XMLTYPE;
    BEGIN
      v_service := UTL_DBWS.CREATE_SERVICE(UTL_DBWS.TO_QNAME(NULL, 'ConsultarItWS'));
      v_call := UTL_DBWS.CREATE_CALL(v_service);
      UTL_DBWS.SET_TARGET_ENDPOINT_ADDRESS(v_call, v_WSDL);
      UTL_DBWS.SET_PROPERTY(v_call, 'OPERATION_STYLE', 'DOCUMENT');
      UTL_DBWS.SET_PROPERTY(v_call, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
      v_request := '
    <ns1:ConsultaSituacioIT xmlns:tns="http://es/tsystems/icam/iit/comunicacioIndirecta/consultarIt/presentacio/webservices/ConsultarItWS.wsdl" xmlns:ns1="http://es.tsystems.icam.iit.comunicacioIndirecta.consultarIt.presentacio.webservices/IConsultarItWS.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_ConsultaSituacioITVO">
      <ns1:usuari  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_UsuariVO">
        <CODI_USUARI  xsi:type="xsd:string">M003</CODI_USUARI>
        <CLAU_USUARI  xsi:type="xsd:string">temp</CLAU_USUARI>
        <NOM_USUARI  xsi:type="xsd:string">Proves</NOM_USUARI>
        <PRIMER_COGNOM_USUARI  xsi:type="xsd:string">Activa</PRIMER_COGNOM_USUARI>
        <SEGON_COGNOM_USUARI  xsi:type="xsd:string"></SEGON_COGNOM_USUARI>
        <NUM_COLEGIAT  xsi:type="xsd:string"></NUM_COLEGIAT>
        <DNI_USUARI  xsi:type="xsd:string">37735679K</DNI_USUARI>
      </ns1:usuari>
      <atencioPrimaria  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_AtencioPrimariaVO">
        <TIPUS_AP_COMUNICADORA  xsi:type="xsd:string">1</TIPUS_AP_COMUNICADORA>
        <CODI_AP_COMUNICADORA  xsi:type="xsd:string">M003</CODI_AP_COMUNICADORA>
        <COLEGIACIO  xsi:type="xsd:string"></COLEGIACIO>
        <CODI_PROVINCIA_COLEGIAT  xsi:type="xsd:string"></CODI_PROVINCIA_COLEGIAT>
        <NUMERO_COLEGIAT  xsi:type="xsd:string"></NUMERO_COLEGIAT>
        <DIGIT_CONTROL_COLEGIAT  xsi:type="xsd:string"></DIGIT_CONTROL_COLEGIAT>
        <NOM_COLEGIAT  xsi:type="xsd:string"></NOM_COLEGIAT>
        <PRIMER_COGNOM_COLEGIAT  xsi:type="xsd:string"></PRIMER_COGNOM_COLEGIAT>
        <SEGON_COGNOM_COLEGIAT  xsi:type="xsd:string"></SEGON_COGNOM_COLEGIAT>
      </atencioPrimaria>
      <ciutada  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_PeticioCiutadaVO">
        <NIC_CIUTADA  xsi:type="xsd:string"></NIC_CIUTADA>
        <NASS_CIUTADA  xsi:type="xsd:string">080213160436</NASS_CIUTADA>
        <NIA_CIUTADA  xsi:type="xsd:string"></NIA_CIUTADA>
        <CIP_CIUTADA  xsi:type="xsd:string"></CIP_CIUTADA>
        <DOCUMENT_ID_CIUTADA  xsi:type="xsd:string">37453036M</DOCUMENT_ID_CIUTADA>
        <TIPUS_DOCUMENT_CIUTADA  xsi:type="xsd:string">1</TIPUS_DOCUMENT_CIUTADA>
        <NOM_CIUTADA  xsi:type="xsd:string">JORGE</NOM_CIUTADA>
        <PRIMER_COGNOM_CIUTADA  xsi:type="xsd:string">ADRO</PRIMER_COGNOM_CIUTADA>
        <SEGON_COGNOM_CIUTADA  xsi:type="xsd:string">MO</SEGON_COGNOM_CIUTADA>
        <GENERE  xsi:type="xsd:string">H</GENERE>
        <DATA_NAIXEMENT  xsi:type="xsd:string">11/01/1952</DATA_NAIXEMENT>
      </ciutada>
      <episodi  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_EpisodiIndicadorAnulacioVO">
        <IND_ANULATS  xsi:type="xsd:string"></IND_ANULATS>
      </episodi>
      <resultat  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_ResultatVO">
        <CODI_ERROR  xsi:type="xsd:string"></CODI_ERROR>
        <DESCRIPCIO_ERROR  xsi:type="xsd:string"></DESCRIPCIO_ERROR>
      </resultat>
    </ns1:ConsultaSituacioIT>
      v_response := UTL_DBWS.INVOKE(v_call, XMLTYPE(v_request));
      RETURN null;
    END K_TEST;Any expert in WSDL that knows how to define the XML for the request to deserialize?
    Thanks for any suggestions,
    K.

    Hi guys,
    I've been using web services before, but I just can't set this one up.
    I tried sooo many different combinations in namespaces and such, but the code below still gives
    ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException: No Deserializer found to deserialize a 'http://es.tsystems.icam.iit.comunicacioIndirecta.consultarIt.presentacio.webservices/IConsultarItWS.xsd:ns1:usuari' using encoding style 'null'. [java.lang.IllegalArgumentException]
    CREATE OR REPLACE FUNCTION K_TEST RETURN VARCHAR2 AS
    v_WSDL      VARCHAR2(100) := 'https://pre.salut.gencat.net/sic_iit/AppJava/ConsultarItWS?WSDL';
    v_service   UTL_DBWS.SERVICE;
    v_call      UTL_DBWS.CALL;
    v_request   CLOB;
    v_response  XMLTYPE;
    BEGIN
      v_service := UTL_DBWS.CREATE_SERVICE(UTL_DBWS.TO_QNAME(NULL, 'ConsultarItWS'));
      v_call := UTL_DBWS.CREATE_CALL(v_service);
      UTL_DBWS.SET_TARGET_ENDPOINT_ADDRESS(v_call, v_WSDL);
      UTL_DBWS.SET_PROPERTY(v_call, 'OPERATION_STYLE', 'DOCUMENT');
      UTL_DBWS.SET_PROPERTY(v_call, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
      v_request := '
    <ns1:ConsultaSituacioIT xmlns:tns="http://es/tsystems/icam/iit/comunicacioIndirecta/consultarIt/presentacio/webservices/ConsultarItWS.wsdl" xmlns:ns1="http://es.tsystems.icam.iit.comunicacioIndirecta.consultarIt.presentacio.webservices/IConsultarItWS.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_ConsultaSituacioITVO">
      <ns1:usuari  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_UsuariVO">
        <CODI_USUARI  xsi:type="xsd:string">M003</CODI_USUARI>
        <CLAU_USUARI  xsi:type="xsd:string">temp</CLAU_USUARI>
        <NOM_USUARI  xsi:type="xsd:string">Proves</NOM_USUARI>
        <PRIMER_COGNOM_USUARI  xsi:type="xsd:string">Activa</PRIMER_COGNOM_USUARI>
        <SEGON_COGNOM_USUARI  xsi:type="xsd:string"></SEGON_COGNOM_USUARI>
        <NUM_COLEGIAT  xsi:type="xsd:string"></NUM_COLEGIAT>
        <DNI_USUARI  xsi:type="xsd:string">37735679K</DNI_USUARI>
      </ns1:usuari>
      <atencioPrimaria  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_AtencioPrimariaVO">
        <TIPUS_AP_COMUNICADORA  xsi:type="xsd:string">1</TIPUS_AP_COMUNICADORA>
        <CODI_AP_COMUNICADORA  xsi:type="xsd:string">M003</CODI_AP_COMUNICADORA>
        <COLEGIACIO  xsi:type="xsd:string"></COLEGIACIO>
        <CODI_PROVINCIA_COLEGIAT  xsi:type="xsd:string"></CODI_PROVINCIA_COLEGIAT>
        <NUMERO_COLEGIAT  xsi:type="xsd:string"></NUMERO_COLEGIAT>
        <DIGIT_CONTROL_COLEGIAT  xsi:type="xsd:string"></DIGIT_CONTROL_COLEGIAT>
        <NOM_COLEGIAT  xsi:type="xsd:string"></NOM_COLEGIAT>
        <PRIMER_COGNOM_COLEGIAT  xsi:type="xsd:string"></PRIMER_COGNOM_COLEGIAT>
        <SEGON_COGNOM_COLEGIAT  xsi:type="xsd:string"></SEGON_COGNOM_COLEGIAT>
      </atencioPrimaria>
      <ciutada  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_PeticioCiutadaVO">
        <NIC_CIUTADA  xsi:type="xsd:string"></NIC_CIUTADA>
        <NASS_CIUTADA  xsi:type="xsd:string">080213160436</NASS_CIUTADA>
        <NIA_CIUTADA  xsi:type="xsd:string"></NIA_CIUTADA>
        <CIP_CIUTADA  xsi:type="xsd:string"></CIP_CIUTADA>
        <DOCUMENT_ID_CIUTADA  xsi:type="xsd:string">37453036M</DOCUMENT_ID_CIUTADA>
        <TIPUS_DOCUMENT_CIUTADA  xsi:type="xsd:string">1</TIPUS_DOCUMENT_CIUTADA>
        <NOM_CIUTADA  xsi:type="xsd:string">JORGE</NOM_CIUTADA>
        <PRIMER_COGNOM_CIUTADA  xsi:type="xsd:string">ADRO</PRIMER_COGNOM_CIUTADA>
        <SEGON_COGNOM_CIUTADA  xsi:type="xsd:string">MO</SEGON_COGNOM_CIUTADA>
        <GENERE  xsi:type="xsd:string">H</GENERE>
        <DATA_NAIXEMENT  xsi:type="xsd:string">11/01/1952</DATA_NAIXEMENT>
      </ciutada>
      <episodi  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_EpisodiIndicadorAnulacioVO">
        <IND_ANULATS  xsi:type="xsd:string"></IND_ANULATS>
      </episodi>
      <resultat  xsi:type="ns1:es_tsystems_icam_iit_comunicacioIndirecta_comuns_vo_ResultatVO">
        <CODI_ERROR  xsi:type="xsd:string"></CODI_ERROR>
        <DESCRIPCIO_ERROR  xsi:type="xsd:string"></DESCRIPCIO_ERROR>
      </resultat>
    </ns1:ConsultaSituacioIT>
      v_response := UTL_DBWS.INVOKE(v_call, XMLTYPE(v_request));
      RETURN null;
    END K_TEST;Any expert in WSDL that knows how to define the XML for the request to deserialize?
    Thanks for any suggestions,
    K.

  • What kind of data types in Web Dynpro can be bound to Interactive Form?

    Hello
    Apparently it is not possible to bind a Web Dynpro Context variable of type boolean to a checkbox in an interactive form. We get the PDF Document Render Exception until the data type is changed to string, then the generation seems to work. Does anyone know what data types in Web Dynpro other than String can be bound to an Interactive Form Document? Is there any information about this in help.sap.com/adobeforums.com/elsewhere? I have researched a bit, but couldn't get a general statement on this topic.
    Thank you for your help!
    Kind regards
    Bettina Hepp

    Hi,
    You can Bind the Boolean type of webdynpro to the CheckBox in Adobe Interactive Form.
    Just define the value Attribute in the Context of type Boolean and bind the Checkbox in Aif with this attribute.
    Sample Code:
    if (wdContext.currentContextelement.reason == true)
    ur validations.....
    Regards
    Mustafa

  • Flex SDK and online emulation coding, your opinion on my project

    Hi to everybody,
    I'm an actionscript developer and I've started a project 2 years ago.
    Since I wanted to test dynamic bitmap generation, I started this path by coding a graphic driver that emulates some old graphic chip used in consoles.
    I could see it can work very well in AS3, so thanks to Flex SDK and FDT I have coded some more complex emulators.
    Llittle by little I've built some classes that emulate some more chips such as SN76489, AY-3-8910, Konami SCC, Namco, TMS9918/TMS9928 and other graphic drivers for arcade emulation.
    There are few project around the web on this subject, some of them such as fMAME are done thanks to Alchemy but, mine is pure AS3 with a lot of otimization, simple code, byte code friendly structures and a lot of caching methods.
    The audio has to be fixed, I still haven't find a good caching way to play the audio generated by emulated sound chips with the streaming feature of flash player. To increase quality and fidelity, I need to rise the buffer, but the delay between a graphic event and its corresponding sound rises too...
    Unfortunately on some old PC and some netbook they are a little slow because they use a lot of CPU and memory. I will be very glad if you can tell me your opinin about this work and eventually your PC configuration you are playing with.
    These are the four consoles/computer I've emulated:
    SEGA SC-3000/SG-1000: http://www.play-sc-3000.com
    SEGA Master System: http://www.digimorf.com/ASms
    MSX 1: http://www.digimorf.com/ASReplay_MSX
    CBS ColecoVision: http://www.digimorf.com/fcv
    And these are some MAME concept based arcade games. To play with these ones you need to use te same control keys of MAME:
    - Click on monitor to focus flash player
    - 5 or 6: Insert Coin
    - 1 or 2: no. of player to start
    - Arrow keys: move
    - X, C: fire buttons 1, 2
    http://www.digimorf.com/FlaME/pacman.htm
    http://www.digimorf.com/FlaME/pacman3D.htm - This uses Away3d for the 3d interactive cabinet, you can rotate and play snce the emulator itself is mapped on the screen object.
    http://www.digimorf.com/FlaME/ladybug.htm
    http://www.digimorf.com/FlaME/pengo.htm
    http://www.digimorf.com/FlaME/crushroller.htm
    http://www.digimorf.com/FlaME/bombjack.htm
    http://www.digimorf.com/FlaME/solomon.htm
    Hope you enjoy them!

    You can set the maximum number of connections by using:
    ServerSocket server = new ServerSocket( port, backlog );
    Where backlog is the number of connections at any one time. I'm not sure - but I'm guessing that the physical limit is dictated by your hardware. Once you queue is full of connections, you are right - any further connections are refused. The default number of connections is 50.
    Mike

  • While in zh|ja locale, zh|ja fonts are used even for Latin... why?

    One thing that has always bothered me is that my system uses funny fonts when it is running in a non-English locale, and I think I finally found the culprit.
    When I check for font matching in English everything seems normal:
    $ fc-match -s "sans"
    DejaVuSans.ttf: "DejaVu Sans" "Book"
    DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
    DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
    DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
    iYaHei.ttf: "iYaHei" "Regular"
    malgun.ttf: "Malgun Gothic" "Regular"
    kartika.ttf: "Kartika" "Regular"
    arialuni.ttf: "Arial Unicode MS" "Normal"
    But, if I were to do it in Chinese or Japanese:
    $ fc-match -s "sans:lang=zh|ja"
    iYaHei.ttf: "iYaHei" "Regular"
    DejaVuSans.ttf: "DejaVu Sans" "Book"
    DejaVuSans-Bold.ttf: "DejaVu Sans" "Bold"
    DejaVuSans-Oblique.ttf: "DejaVu Sans" "Oblique"
    DejaVuSans-BoldOblique.ttf: "DejaVu Sans" "Bold Oblique"
    malgun.ttf: "Malgun Gothic" "Regular"
    kartika.ttf: "Kartika" "Regular"
    arialuni.ttf: "Arial Unicode MS" "Normal"
    DejaVuSans goes /after/ iYaHei. This is a problem, as iYaHei's Latin glyphs look horrible; its CJK glyphs, while not the best, are at least extensive, which is why I use it. For monospace it is even more of a problem, because then Arial MS Unicode, which isn't even a monospace font gets priority over DejaVu Sans Mono in zh|ja environments.
    This is my current fonts.conf:
    <fontconfig>
    <alias>
    <family>Monospace</family>
    <prefer>
    <family>DejaVu Sans Mono</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <alias>
    <family>sans-serif</family>
    <prefer>
    <family>DejaVu Sans</family>
    <family>iYaHei</family>
    <family>Malgun Gothic</family>
    <family>Kartika</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <alias>
    <family>serif</family>
    <prefer>
    <family>Times New Roman</family>
    <family>AR PL New Sung</family>
    <family>MS Mincho</family>
    <family>MingLiU</family>
    <family>MingLiU-ExtB</family>
    <family>MingLiU_HKSCS-ExtB</family>
    <family>MS Song</family>
    <family>UnBatang</family>
    <family>RaghuMalayalam</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <dir>/home/sokuban/.fontmatrix</dir>
    <dir>/home/sokuban/.Fontmatrix/Activated</dir>
    </fontconfig>
    This is probably happening because while I'm in a zh|ja locale, the system is looking for the highest font on my priority list that says it is a zh|ja font and then uses it—even to cover Latin etc glyphs that fonts higher in my priority list can cover; I'm guessing this is because it is assuming that those fonts aren't suitable for use in a zh|ja environment.
    So the simplest way to solve the problem that everyone would immediately think of is to say that DejaVu can do zh|ja. I (presume) it wouldn't cause any problems even though they can't, because then they will simply borrow from real zh|ja fonts and will now at least be used in a zh|ja locale. Actually, I would want this behaviour no matter what way I decide to solve the problem.
    The other—and better—solution to the problem would be to specifically set a different priority list to be used for different languages. That way when the system looks for "sans:lang=zh_TW", it'll get DejaVu at the top of the list to handle Latin, and then a nice traditional Chinese font. Likewise if the system looked for "sans:lang=ja", it'll get DejaVu with a nice Japanese font. Before I didn't think this was possible, but now that I see how this font matching is working, it would be weird if it wasn't possible.
    Right now I have these nice Chinese/Japanese fonts installed on my system, but I don't always get to use them (mostly while browsing, if the html is nice enough). I made my system default iYaHei (and the firefly font for serif) because iYaHei covers almost all of CJK and is readable. If I were to put one of the nice Chinese or Japanese fonts as my system default, I'd end up having some glyphs being borrowed from another font, and it looks really ugly when this happens. Monolinguals don't have this problem, because they can just set their system font to their language, and then be done with it, as they'll rarely need to display any glyphs unsupported.
    If anyone can help me, especially with getting a different priority list for different languages, it would be appreciated.

    Hmm, that seems to work fine for one language, but I put 4 languages in there and only the first one I put works properly:
    This would be my fontconfig
    <fontconfig>
    <match>
    <test name="lang" compare="contains">
    <string>zh_TW</string>
    </test>
    <test name="family">
    <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Serif</string>
    <string>Bitstream Vera Serif</string>
    <string>MingLiU</string>
    <string>MingLiU-ExtB</string>
    <string>MingLiU_HKSCS-ExtB</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>zh_TW</string>
    </test>
    <test name="family">
    <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans</string>
    <string>Bitstream Vera Sans</string>
    <string>Microsoft JhengHei</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>zh_TW</string>
    </test>
    <test name="family">
    <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans Mono</string>
    <string>Bitstream Vera Sans Mono</string>
    <string>WenQuanYi Zen Hei Mono</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>zh_CN</string>
    </test>
    <test name="family">
    <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Serif</string>
    <string>Bitstream Vera Serif</string>
    <string>MS Song</string>
    <string>WenQuanYi Bitmap Song</string>
    <string>AR PL New Sung</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>zh_CN</string>
    </test>
    <test name="family">
    <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans</string>
    <string>Bitstream Vera Sans</string>
    <string>Microsoft YaHei</string>
    <string>WenQuanYi Zen Hei</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>zh_CN</string>
    </test>
    <test name="family">
    <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans Mono</string>
    <string>Bitstream Vera Sans Mono</string>
    <string>WenQuanYi Zen Hei Mono</string>
    <string>AR PL New Sung</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ja</string>
    </test>
    <test name="family">
    <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Serif</string>
    <string>Bitstream Vera Serif</string>
    <string>MS PMincho</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ja</string>
    </test>
    <test name="family">
    <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans</string>
    <string>Bitstream Vera Sans</string>
    <string>Meiryo</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ja</string>
    </test>
    <test name="family">
    <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans Mono</string>
    <string>Bitstream Vera Sans Mono</string>
    <string>MS Gothic</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ko</string>
    </test>
    <test name="family">
    <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Serif</string>
    <string>Bitstream Vera Serif</string>
    <string>Batang</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ko</string>
    </test>
    <test name="family">
    <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans</string>
    <string>Bitstream Vera Sans</string>
    <string>Malgun Gothic</string>
    </edit>
    </match>
    <match>
    <test name="lang" compare="contains">
    <string>ko</string>
    </test>
    <test name="family">
    <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans Mono</string>
    <string>Bitstream Vera Sans Mono</string>
    <string>UnTaza</string>
    </edit>
    </match>
    <alias>
    <family>Monospace</family>
    <prefer>
    <family>DejaVu Sans Mono</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <alias>
    <family>sans-serif</family>
    <prefer>
    <family>DejaVu Sans</family>
    <family>iYaHei</family>
    <family>Malgun Gothic</family>
    <family>Kartika</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <alias>
    <family>serif</family>
    <prefer>
    <family>Times New Roman</family>
    <family>AR PL New Sung</family>
    <family>MS Mincho</family>
    <family>MingLiU</family>
    <family>MingLiU-ExtB</family>
    <family>MingLiU_HKSCS-ExtB</family>
    <family>MS Song</family>
    <family>UnBatang</family>
    <family>RaghuMalayalam</family>
    <family>Arial Unicode MS</family>
    </prefer>
    </alias>
    <dir>/home/sokuban/.fontmatrix</dir>
    <dir>/home/sokuban/.Fontmatrix/Activated</dir>
    </fontconfig>
    I had to put zh_TW at the very top, otherwise matching for zh_TW would pull up meiryo first. There is still one little problem in that matching for ko will pull up MS Mincho before Batang, but whatever, I don't really care that much. Meiryo and Malgun Gothic also still go before DejaVu Sans for some reason, but this again doesn't really matter, and might actually be a good thing.
    So far setting it like this seems to work to some degree. More of Niconico Douga uses Meiryo now (the search bar and stuff still uses iYaHei, but I don't think much can be done about that), if I run a program with LANG=ja_JP.UTF-8 and it has Japanese support it'll use Meiryo too. But this doesn't work with Chinese. (I guess because I had country codes in my Chinese matching rules) Oh well, this is still a step up, and Trad Chinese with a Simp Chinese font isn't as bad as Japanese with a Simp Chinese font; I've gotten used to seeing it everywhere. (Heck, the book I'm using to study Chinese now is a translation from a book made to study Simplified - and although it is a traditional book, it still uses the same simplified font.)
    EDIT: Actually, it doesn't seem to have anything to do with the program having Japanese support or not. Some programs will use Meiryo, others will completely ignore the fontconfig settings (and use iYaHei). Sonata for example, even though it had a working Japanese localization, used iYaHei, while thunar and mousepad used Meiryo.
    I used to have this bug that pretty much made working in CJK locales impossible, it took a really long time to open up terminals because of the messed up font settings. This seems to be fixed in a Japanese locale, but not a Taiwanese. Again, I guess this has to do with the country code above. (If you use a country code do you need to put a different syntax? Because other than the fc-match -s "sans:lang=zh_TW" results, the Chinese lines don't seem to have any effect—though I guess if that command shows it, they must be affected?)
    Also, I'm not sure if I've been blind and not noticed it until now, but after applying these Changes /all/ kana are using Meiryo. (Unless specified otherwise) This is both a good thing and a bad thing—no, I think it is a bad thing. Because Japanese text uses kana and kanji (CJK unified block). So now when I have a Japanese filename in thunar, the kana shows up using a proper Japanese font, but the Chinese Characters in the name show up using a Chinese font. While this is kind of okay of the fonts look similar, it isn't a good solution because not all fonts are designed to work well with each other, and my main goal in this quest is to avoid having to "borrow" from another font when the default font can't display a glyph properly. (Meiryo and iYaHei kiiinda look similar, so it isn't that bad, but if one day I decided to set my default gtk font to serif for some reason then I'll have problems for sure.) If somehow the system was able to tell if the text was Japanese or Chinese and use the appropriate font, that would be good, but I am aware that that sort of magic is impossible.
    I want the computer to be able to use the correct font when some program specifies the text is in that language (perhaps by the locale, or perhaps by the other magic method niconico uses), but I want the english locale to use iYaHei for everything just to be safe because it works.
    I have tried doing something like:
    <match>
    <test name="lang" compare="contains">
    <string>en</string>
    </test>
    <test name="family">
    <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="same">
    <string>DejaVu Sans</string>
    <string>iYaHei</string>
    <string>Malgun Gothic</string>
    <string>Kartika</string>
    <string>Arial Unicode MS</string>
    </edit>
    </match>
    Hoping that that would allow iYaHei to be used as the main fallback while using an English locale, but that doesn't happen; it still uses Meiryo for Kana, but it uses WenQuanYi Zen Hei for Chinese, which looks even worse than Meiryo and iYaHei.
    So now I'm debating whether to use the new configurations or the old configurations. The new configurations fix a few things in Japanese locales, but cause a possibly grave problem in non-Japanese locales. I'm sure it has a few other effects too, but I didn't notice them yet.
    What exactly is this fontconfig format supposed to do? Because it clearly isn't "setting a priority list for fonts to be used in a certain language". It seems more like "setting a priority list for fonts that are labelled as a certain language". Or maybe it just does some random stuff to the fonts described. I can't tell.
    The core of the problem seems to be in the fonts themselves. Somehow, these fonts are claiming to cover "Chinese, Japanese, Korean" etc etc and while they probably do that, most can only cover 1 language in an acceptable way. Where do the fonts store this information? Is there a way to edit this?
    Last edited by sokuban (2009-12-04 19:24:41)

  • Rendering text with each individual letter outlined

    I'm wondering if there's a (simple, inbuilt) way to render
    text where each letter is outlined in a differnt colour.
    If you don't know what I mean here is some
    Sample
    Text.
    The Regular text is the font render in a solid colour. The
    funky text is a font rendered in yellow but with a green outline
    around it. Is there a way to format text programmatically like that
    or will I have to render my alphabet to a bitmap and build up
    strings with bitmaps if I want that effect.

    You can try adding a glow filter to the textfield, setting the color to black, the Strength to a high percentage (like 1000), quality to Low, and Blur X and Y to suit your desired visual result

  • UPdate by an hour

    Hi Der,
    I am stuck in here to update to scedule the report by an hour later if failed
    Here is the piece of code, and my objective is to update the Schedule date by an lhour later of pickup date
    Please advise
    Timestamp U_Pdate = rs.getTimestamp("sr_pickup_date");
            String Udef = rs.getString("REP_DEFN_NAME");
            String UEmail = rs.getString("REP_EMAIL_ADDRESS");
            int UID = rs.getInt("REP_CUS_ID");
            int UCid = rs.getInt("REP_CREATED_BY_ID");
            //Ends here
          String emailTo = props.getProperty(PFEConfigItems.EMAIL_ERROR_ADDRESS);
          String subject = "Report Generation Failed (" + scheduleId + ")";
          String message = subject + "\n\nMessage: " + error + "\n\nDetail:\nID: "+ Udata+ "\n\nDescription: "
          + Udesc+ "\n\nCreated Date: "+ U_Cdate+ "\n\nSchedule Date: "+ U_Sdate+ "\n\nPickup Date: "+ U_Pdate
          + "\n\nReport Generated: "+ Udef+ "\n\nEMAIL ADDRESS: "+ UEmail+ "\n\nCustomer ID: "+ UID
          + "\n\nCompany ID: "+ UCid;
          String from = props.getProperty(PFEConfigItems.EMAIL_FROM_NAME);
          String emailFrom = props.getProperty(PFEConfigItems.EMAIL_FROM_ADDRESS);
          MailDispatcher dispatcher = new MailDispatcher(new Properties(),props);
          dispatcher.sendMessage(emailTo, subject, message, from, emailFrom, null);
          //these are update changes
          StringBuffer sql1 = new StringBuffer();
          sql1.append("Update scheduled_report ");
    //Here is my problem when I am trying to set the schedule date to pickupdate
          sql1.append("set sr_scheduled_date = to_date('"+U_Pdate+"','dd/mm/yyyy hh24:mi:ss') ");
          sql1.append(",sr_pickup_date = null, sr_processor_id = null ");
          sql1.append("where  sr_id = ");
          sql1.append(scheduleId);
          PooledConn pc2 = null;
          Statement stmt2 = null;
          pc2 = getConnection();
          stmt2 = pc2.get().createStatement();
          stmt2.execute(sql1.toString());
          pc2.commit();

    First you start by using a PreparedStatement rather than creating the SQL yourself.
    Second you use a Calendar to add an hour before.

  • Generate objects dynamically.

    I'm now trying to make a menu from my application. This menu is generated using plain text file to generate the JMenu, JMenuItem objects. That's not difficult but the problem comes when I want this objects to instantiate objects dynamically. See the example below.
          public MasterForm generate (String classname)
               //Dynamic generation of objects
           }The objects are not always from the same class, that's the reason I pass my method an argument to make my classes. All classes must have some methods so I'm using inheritance. I've been reading the documentation about class Class but the newInstance method doesn't allow you to pass arguments. What should I use?

    I had a similar problem and I created an instance every object that was supposed to be generated dynamically had to implement. Then you can instantiate them using something like:
                                Plugin plugin;
              // System.out.println("Plugin: " + name);
              Class c;
              try
                   c = Class.forName(entrypoint);
                   plugin = (Plugin)c.newInstance();
                   //do whatever you want with the interface...
              catch (Exception e)
                   e.printStackTrace();
              }Where entrypoint in this case is the path to the implementing class inside a jar file and Plugin is the name of the interface.

  • Extracting Base64 images embeded inside XML and Convert it into PDF using Biztalk

    Hi,
    I'm presently working in a scenario, where we will be getting huge XML Files containing Base64 encoded images. The scenario goes like this :-
    1) Client will dump the XML files with embedded Base64 images in a sFTP location.
    1) Firstly, we have to extract Base64 encoded images and the metadata from the XML file.
    3) Secondly, we need to convert the extracted Base64 encoded image into multiple pdf.
    4) Then merge the PDF's into a single file.
    5) Then the merge pdf will store to a particular location.
    5) It is presume that, the file will be of very big in size ~ 1 GB XML file, so we need to take care of the performance as well.
    The sample xml looks like:-
    <ns0:tran xmlns:ns0="http://Sample.Schemas.Record_XML">
      <tranheader>
      </tranheader>
      <item>
        <image>
          <frontimage>
            <frontimage> image 1 part 1</frontimage>
          </frontimage>
          <rearimage>
            <rearimage>image 1 part 2</rearimage>
          </rearimage>
          <frontimage>
            <frontimage> image 2 part 1</frontimage>
          </frontimage>
          <rearimage>
            <rearimage>image 2 part 2</rearimage>
          </rearimage>
          <frontimage>
            <frontimage> image 3 part 1</frontimage>
          </frontimage>
          <rearimage>
            <rearimage>image 3 part 2</rearimage>
          </rearimage>
        </image>
      </item>
      <trantrailer>
      </trantrailer>
    </ns0:tran>
    Thanks & Regards

    Do you really need to use BizTalk for this requirement? This can be done better with standard .NET code through a Windows service/schedule task/ if you want to poll,
    you can implement file watcher class and poll the file as when it arrive to SFTP folder and convert the image in base64 to PDFs.
    Another point, I don’t know why you want to “convert the extracted Base64 encoded
    image into multiple pdf” (Point-3) and “Then merge the PDF's into a single file”-
    point4. You can create a single PDF file (unless I don’t know the reason for creating separate PDF file and merge it again as single PDF file)
    Anyway, if you still need to use BizTalk, you have somes options in general:
    Option1:
    Receive the message using BizTalk receive location using passthrouhg pipeline at receive end
    Create a send port with filter for receive portname. In the send port use a custom send pipeline. In the send pipeline use a custom pipeline component which will extract the base64 content from
    the XML file, convert the base64 encoded image as PDF and send the PDF file in the send port level.
    Option 2 – this options works better if you have some process based on your
    <tranheader> record:
    Receive the message using BizTalk receive location using a custom pipeline strip off, decode and store the base64
    encoded document in a temporary store (file system). So when the message is published in message box db, the message doesn’t contain the heafty encoded64 data part, message will be light weight when its published into message box.
    Process the XML message (without bae64 encoded document) with or without orchestration where you will do processing based on your
    <tranheader> record.
    In send last moment –at send port level, retrieve the stored file from the
    temporary store (file system), convert the image to PDF (i,e, hefty processing like creation of PDFs/merging) can be done at the send pipeline level and send the PDF file
    to destination.
    Following are the guidelines you should keep in mind if you need to achieve this process in BizTalk:
    Try to avoid publishing the hefty message to message box.
    Conversion of base64 to PDF can be done only using a .NET code. So your options to do this conversion in BizTalk are either in Receive pipeline/send pipeline/ .NET helper in orchestration.
    Try not to use Orchestration as much as possible, because of heavy processing and message transmission is already involved.
    Following articles shall help you in this context:
    Dealing with base64 encoded XML documents in BizTalk
    To convert Base64 to PDF/JPEG using C# code:
    TechNet-Wiki Code: Converting Base64 strings
    to Bitmap images
    Convert Image to Base64 String and Base64
    String to Image
    Base64 encoding and decoding in .NET
    Regards,
    M.R.Ashwin Prabhu
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Bitmap Join Index generation in DDL

    I am unable to figure out how to have a bitmap join index defined in the Physical Model be generated in the DDL out of Oracle SQL Deleveloper Data Modeler.
    Please advise how this can be done.
    Thanks!

    Hi,
    The Properties Editor for a Bitmap Join Index has an "Index Columns" tab. The relevant columns on the related "Dimension" Tables should be moved to the "Selected Columns" list on this tab.
    As Philip said, you need to make sure the Physical Model is open before you do the DDL generation.
    When you select the Generate button, the DDL Generation Options dialog is displayed. This has a set of tabs below the main panel. You can select the Bitmap Join Indexes tab, and check that your Bitmap Join Index appears there and its "Selected" check box is selected. (If it's not selected, select it.)
    The DDL for your Bitmap Join Index should appear close to the end of the generated DDL.
    David

  • String random generation for length 3

    Dear Sir,
    How can i generate random generation of alphabets of length 3 in labview?
    ex:adg,beg etc
    Thanks in Advance
    Regards,
    Sai Chitra.

    Hi chitrar,
    Here is a way for caps only:
    1) Use decimal to ASCII numbers for your letters 
    2) Generate a random number from 0-25
    3) Add the result to the first letter (A) position which is 65
    4) Repeat 3 times
    5) Convert to U8 and then use Byte Array to String to get your string
    Note if you want lower case also, change the 25 to 51 and then add 7 if the random number result is greater than 25.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    random alphas.vi ‏9 KB

  • Automatic generation of enum members from name Strings

    I have a program in which I read information about Target objects from a text file. I store some of this information as an enum property of the target.
    }else if (itemKey.equalsIgnoreCase( "type")) {
    currentTarget.descriptor= itemValue;
    currentTarget.type = Target.getTargetType(currentTarget.descriptor);And elsewhere in the program I do the file reading and assignment of instance variables:
    class Target{
    enum TargetType {COUGH_DROP, RICE_CRACKER, PEPTO_BISMOL,UNDETERMINED};
    String descriptor;
    TargetType type;
    returns the target' s type as specified by a descriptor
    public static TargetType getTargetType (String descriptorString) {
    if (descriptorString.equals( "rice cracker")) {
    return (TargetType.RICE_CRACKER);
    } else if (descriptorString.equals ("cough drop")){
    return (TargetType.COUGH_DROP);
    } else if (descriptorString.equals ("Pepto-Bismol")){
    return (TargetType.PEPTO_BISMOL);
    } else {
    return (TargetType.UNDETERMINED);
    } I would like to be able to automatically generate the members of the TargetType enum from a list of strings as opposed to needing a method such as getTargetType above. Is this possible?
    Regards,
    Joe
    PS: I completely apologize for the appearance of the code above. I have no idea why this editor removed my indentation and added HTML markers. (I copied the code from a text editor, pasted into this editor, selected the code sections and clicked on the code button )
    PPS I now see that after a couple of switches between preview and rich text in the HTML markers have disappeared. WTF?

    I'm very curious to understand why one would like to create enum constants at run time? How can therse enums be used in the code that is not created at runtime? What are you really trying to achieve
    I know you marked your question as answered, but... you may have a look at the code below. It is a very very simple example of how to map real life descriptions (at runtime) to pre-existing enums. I didn't test it, but for all I know it should just work. Does this solve the problem that you are experiencing?
    import java.util.HashSet;
    import java.util.Set;
    public enum TargetType {
        RICE_CRACKER("C:/Descriptions/RiceCrackers.txt"),
        COUGH_DROP("C:/Descriptions/CouphDrops.txt"),
        PEPTO_BISMOL("C:/Descriptions/PeptoBismol.txt"),
        UNDETERMINED("C:/Descriptions/Empty.txt"),
        public static TargetType getType(String description) {
         for (TargetType targetType : TargetType.values()) {
             if (targetType.contains(description)) {
              return targetType;
         return UNDETERMINED;
        private final String fileName;
        private Set<String> descriptions = null;
        private TargetType(String fileName) {
         this.fileName = fileName;
        private boolean contains(String description) {
         if (descriptions == null) {
             descriptions = new HashSet<String>();
              * Populate descriptions from fileName.
         return descriptions.contains(description);
    }Piet

  • Numbers saved as strings in excel using report generation

    I am using "Excel easy table.vi" to collect data from LabVIEW to excel. The problem is that the number array I read from LabVIEW, is stored as strings in excel. I want to save those as scientific numbers.
    I have tried using "set cell format.vi", but it will not help me.
    Can anyone help me?
    Paul
    Attachments:
    block diagram.png ‏84 KB
    excel.png ‏10 KB

    Hi Paul,
    What did you use for the number format input ? Can you send your VI ?
    It works perfectly fine for me :
    Regards,
    Da Helmut
    Attachments:
    VI.zip ‏26 KB
    test.png ‏35 KB
    exemple.PNG ‏22 KB

  • String generation

    Hello,
    I wanted to implement a code that generates a permutation of string but could not get it right. E.g., a string "BOLD" will generate 4! (factorial) which is 24 different strings including the initial string. All the generated strings will have the same length and characters like the original string. Some of the generated strings from "BOLD" would be: "BODL", "BDOL", "BLDO", "OLDB" etc.
    Please just an idea on how to go about it or a pseudo code.
    Thanks for your help,
    Jona_T

    Here's how you generate permutations:
    From Knuth's Art of Computer Programming, part I (1.2.5, page 46):
    For each permutation a_1, a_2, ..., a_n-1, of {1,2,...,n-1},
    form n others by inserting n in all possible places,
    obtaining:
       [n] a_1     a_2 ...     a_n-1    ,
           a_1 [n] a_2 ...     a_n-1    ,
           a_1     a_2 ... [n] a_n-1    ,
           a_1     a_2 ...     a_n-1 [n]

Maybe you are looking for