[SOLVED] Changing font in urxvt, what's available?

I'm trying to change the font used in urxvt. Currently my .Xresources has the line:
URxvt.font: xft:terminus:size=9
This appears to be working. However, I'm not sure how to find the correct name for other fonts. The wiki says to look in /usr/share/fonts/misc/fonts.alias Mine can be found here: http://pastebin.com/EPH3DdWT
Apparently those full names work for bitmap fonts and the syntax I used above is for xft fonts.
As an example, say I'd like to set my urxvt font to Oxygen Mono. How do I determine if that font uses bitmap or xft? If bitmap, how do I find the full name in fonts.alias? If xft, how do I find the name to be used? ("oxygen mono", "oxygen-mono", etc)
Last edited by ioos (2012-04-18 21:47:11)

If you installed xorg-fonts-100dpi or xorg-fonts-75dpi or the artwiz-fonts you would have quite a few pcf fonts, such as Courier and Lucida Typewriter.  Many show up when I list monospace fonts.  fc-list is used to list and filter the fonts that fontconfig knows.  If you want to know most of the options a particular font has, you use th '-v' option to fc-list.  '-f' is used to format and filter the information that is in the output.
$ fc-list -f "%{file}\n" :spacing=100 | grep pcf ## monospace pcf font files
/usr/share/fonts/100dpi/lutBS19.pcf.gz
/usr/share/fonts/artwiz-fonts/smoothansi.pcf
...<cut>
Try the difference between something like these two commands:
$ fc-list :family=LucidaTypewriter:style=Sans ## then try...
$ fc-list -v :family=LucidaTypewriter:style=Sans
You should be able to figure out the different font properties by referencing the documentation.  A font does not have to include all (any?) of the font properties given in the fontconfig docs.
Last edited by thisoldman (2012-04-18 01:34:26)

Similar Messages

  • [SOLVED]Change font issue

    Hi, im new to Arch , im happy with it so far! But I want to get my favorite font "terminus" to work. I've read the wiki and i've also checked the FAQ for urxvt how to change font with no success. Im using latest Arch and I use urxvt as my terminal and awesome as wm, and i want the font to work on those both and in luakit if its possible. I've setup my xinitrc to make terminus work i've also resintalled it ones cuz I thought the font was broken or something. I used "URxvt.font:terminus" in my $HOME/.Xdefaults with no success. Ive also tried to add it to my rc.conf but it didnt make the font work in X(i havent checked if it appears on the commandline with no X up and running).
    I hope i could get some help
    Last edited by GNUkid (2012-03-11 18:36:38)

    karol wrote:
    urxvt*font: -*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*
    works for me.
    Post your .Xdefaults.
    Didnt work Heres my .Xdefualts:
    urxvt*font: -*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*
    URxvt.foreground: #1793D1
    URxvt.background: #555753
    URxvt.scrollBar: off
    magicalChicken wrote:
    .Xdefaults is deprecated, use .Xresources instead. Try in .Xresources adding
    urxvt*font: <name of font>
    Then to your .xinitrc add
    xrdb --merge ~/.Xresources
    I use this for setting the inconsolata font as default in urxvt and it works just fine.
    The .Xresources didnt work for me for some reason so thats why im using Xdefaults.

  • I want to change fonts but get message "no available system font"

    I am trying to edit a PDF flyer created by another party.  Using Acrobat Pro on Mac OSX.  I select "edit document text" and then try to delete or change the text and get the message. "all or part of the selection has no available system font You cannot add or delete text using the currently selected font"
    I don't see any font format bar or other method of changing the font.
    Is there a way to work this?

    Over at the AUC's "Acrobat Answers" Karl Kremer replied to a similar question.
    In part he wrote:
    "I assume you want to edit content in a PDF file, and you cannot do that because you don't have the font installed that is used in that file. That is the way Acrobat works: You need to have the font that is used in your document installed on your local computer in order to make changes to text that uses that font. There is no way around that. You will have to find out what font is used for the text you need to edit, and then acquire that font (and that usually means to purchase that font, unless you are a subscriber to e.g. CC and that font is available via TypeKit).
    Another option is to select all the text and change that text to a different but similar font. You again can only use a font that is available on your computer as the target font. But once you've done that, you should be able to edit your document.
    You change the font by selecting Tools>Content Editing>Edit Text & Images, then you select the text you want to change, and your target font." 
    Be well...

  • [Solved] Emoji fonts in URxvt

    I'm attempting to get emoji (and ideally the entire utf8 set) working in my terminal and other programs.
    In my .Xresources I previously had just Terminus, I've found that Symbola is the font that you want to display emoji? So I figured that the following line would work but emoji characters are still not showing up after restarting Awesome WM and restarting my terminals.
    URxvt.font:                    Symbola,xft:Terminus:pixelsize=16
    Any hints or tips on where to look would be much appreciated!
    Last edited by Napaim (2014-08-05 12:30:09)

    My bad, I'm stupid.
    You need to restart Xorg server before the .Xresources settings take effect. I was just restarting Awesome WM.

  • I'm using firefox 6.0.2 It's making problem with Bangla font ONLY on FACEBOOK others bangli website FORNT SIZE are OK. On the FACEBOOK it shows Bangla font in a very / Too small! I change font SIZE in firefox setting but i can't solve. Pls HELP me

    I'm using firefox 6.0.2 It's making problem with Bangla font ONLY on FACEBOOK others bangli website FORNT SIZE are OK. On the FACEBOOK it shows Bangla font in a very / Too small! I change font SIZE in firefox setting but i can't solve. Pls HELP me ..

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    *http://kb.mozillazine.org/Zoom_text_of_web_pages
    You can use an extension to set a default font size and page zoom on web pages.
    *Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
    *NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/

  • [Solved] - Inconsolata Font & urxvt

    Hi!
    Just changing a bit my configuration.
    I try to change the font in urxvt but I encountered an issue.
    URxvt.font: xft:Inconsolata:Medium:size=12
    URxvt.boldFont: xft:Inconsolata:Bold:size=12
    The bold font isn't working, and.
    Do you have some suggestion ?
    Thanks.
    Last edited by Thom (2013-04-15 21:26:19)

    I just take it from aur :
    https://www.archlinux.org/packages/comm … consolata/
    But, it's look, there is no bold, and italic.

  • I recently moved to USA from Canada. I have not changed my apple id but I have changed my phone and computer. Is there a way to retrieve my purchased music via iTunes? I checked what was available to download and only got a few digital booklets.

    I recently moved to USA from Canada. I have not changed my apple id but I have changed my phone and computer. Is there a way to retrieve my purchased music via iTunes? I checked what was available to download and only got a few digital booklets.

    Most Windows users don't.
    Purchase an external hard drive and use the backup software that comes with it to backup files from your computer.
    Buy TouchCopy and install it on your new computer, connect your old iPod and transfer your songs to your computer.

  • PSE 9... Can't change Fonts

    "Set Font Family" doesn't work on  pse 9. Font is stuck on myriad_pro. I've tried uninstalling and reinstalling pse 9 to no avail. Then I downloaded an update of pse 9. I still can't change fonts. Please help!

    Barbara, your question was:" What exactly is the problem? is that you can't scroll the font list? Try using the arrow keys. Does that work?"     I replied on the Forum yesterday(modified slightly today):
    The problem is that the arrow next to the font window doesn't cause a drop down menu of font choices to appear. At your suggestion, I tried the arrow keys and I discovered that they cause a single change of fonts in the font window. Navigating the list of fonts one font at a time in the future will be painful but doable. I'd like to return to the drop down menu function where I can quickly scroll the whole list of fonts and make a change rapidly. 
    Currently when I click on the font menu arrow,  the screen makes a vertical 1/4 " "jerk", so the signal is rec'd, but there's no drop down menu response.
    Additionally, the following commands to the right of the anti alias command are "grayed out" (not functional): faux bold, faux italics, underline,strike through, warped text, and change text orientation.
    Your suggestion to use the arrow keys was somewhat helpful.  If I can't find a fix I may have to go to a popular font like Arial and just stick with it. I'm afraid to buy the latest version ( PSE 12) as I'm not sure it would solve the problem.
    PawPaw

  • How to change font/ font color etc in a graphic object using JCombobox?

    Hello
    My program im writing recently is a small tiny application which can change fonts, font sizes, font colors and background color of the graphics object containing some strings. Im planning to use Jcomboboxes for all those 4 ideas in implementing those functions. Somehow it doesnt work! Any help would be grateful.
    So currently what ive done so far is that: Im using two classes to implement the whole program. One class is the main class which contains the GUI with its components (Jcomboboxes etc..) and the other class is a class extending JPanel which does all the drawing. Therefore it contains a graphics object in that class which draws the string. However what i want it to do is using jcombobox which should contain alit of all fonts available/ font sizes/ colors etc. When i scroll through the lists and click the one item i want - the graphics object properties (font sizes/ color etc) should change as a result.
    What ive gt so far is implemented the jcomboboxes in place. Problem is i cant get the font to change once selecting an item form it.
    Another problem is that to set the color of font - i need to use it with a graphics object in the paintcomponent method. In this case i dnt want to create several diff paint.. method with different property settings (font/ size/ color)
    Below is my code; perhaps you'll understand more looking at code.
    public class main...
    Color[] Colors = {Color.BLUE, Color.RED, Color.GREEN};
            ColorList = new JComboBox(Colors);
    ColorList.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ev) {
                     JComboBox cb = (JComboBox)ev.getSource();
                    Color colorType = (Color)cb.getSelectedItem();
                    drawingBoard.setBackground(colorType);
              });;1) providing the GUI is correctly implemented with components
    2) Combobox stores the colors in an array
    3) ActionListener should do following job: (but cant get it right - that is where my problem is)
    - once selected the item (color/ font size etc... as i would have similar methods for each) i want, it should pass the item into the drawingboard class (JPanel) and then this class should do the job.
    public class DrawingBoard extends JPanel {
           private String message;
           public DrawingBoard() {
                  setBackground(Color.white);
                  Font font = new Font("Serif", Font.PLAIN, fontSize);
                  setFont(font);
                  message = "";
           public void setMessage(String m) {
                message = m;
                repaint();
           public void paintComponent(Graphics g) {
                  super.paintComponent(g);
                  //setBackground(Color.RED);
                  Graphics2D g2 = (Graphics2D) g;
                  g2.setRenderingHint             
                  g2.drawString(message, 50, 50);
           public void settingFont(String font) {
                //not sure how to implement this?                          //Jcombobox should pass an item to this
                                   //it should match against all known fonts in system then set that font to the graphics
          private void settingFontSize(Graphics g, int f) {
                         //same probelm with above..              
          public void setBackgroundColor(Color c) {
               setBackground(c);
               repaint(); // still not sure if this done corretly.
          public void setFontColor(Color c) {
                    //not sure how to do this part aswell.
                   //i know a method " g.setColor(c)" exist but i need to use a graphics object - and to do that i need to pass it in (then it will cause some confusion in the main class (previous code)
           My problems have been highlighted in the comments of code above.
    Any help will be much appreciated thanks!!!

    It is the completely correct code
    I hope that's what you need
    Just put DrawingBoard into JFrame and run
    Good luck!
    public class DrawingBoard extends JPanel implements ActionListener{
         private String message = "message";
         private Font font = new Font("Serif", Font.PLAIN, 10);
         private Color color = Color.RED;
         private Color bg = Color.WHITE;
         private int size = 10;
         public DrawingBoard(){
              JComboBox cbFont = new JComboBox(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
              cbFont.setActionCommand("font");
              JComboBox cbSize = new JComboBox(new Integer[]{new Integer(14), new Integer(13)});
              cbSize.setActionCommand("size");
              JComboBox cbColor = new JComboBox(new Color[]{Color.BLUE, Color.RED, Color.GREEN});
              cbColor.setActionCommand("color");
              JComboBox cbBG = new JComboBox(new Color[]{Color.BLUE, Color.RED, Color.GREEN});
              cbBG.setActionCommand("bg");
              add(cbFont);
              cbFont.addActionListener(this);
              add(cbSize);
              cbSize.addActionListener(this);
              add(cbColor);
              cbColor.addActionListener(this);
              add(cbBG);
              cbBG.addActionListener(this);
         public void setMessage(String m){
              message = m;
              repaint();
         protected void paintComponent(Graphics g){
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(bg);//set background color
              g2.fillRect(0,0, getWidth(), getHeight());          
              g2.setColor(color);//set text color
              FontRenderContext frc = g2.getFontRenderContext();
              TextLayout tl = new TextLayout(message,font,frc);//set font and message
              AffineTransform at = new AffineTransform();
              at.setToTranslation(getWidth()/2-tl.getBounds().getWidth()/2,
                        getWidth()/2 + tl.getBounds().getHeight()/2);//set text at center of panel
              g2.fill(tl.getOutline(at));
         public void actionPerformed(ActionEvent e){
              JComboBox cb = (JComboBox)e.getSource();
              if (e.getActionCommand().equals("font")){
                   font = new Font(cb.getSelectedItem().toString(), Font.PLAIN, size);
              }else if (e.getActionCommand().equals("size")){
                   size = ((Integer)cb.getSelectedItem()).intValue();
              }else if (e.getActionCommand().equals("color")){
                   color = (Color)cb.getSelectedItem();
              }else if (e.getActionCommand().equals("bg")){
                   bg = (Color)cb.getSelectedItem();
              repaint();
    }

  • How to change Font Size of Object Explorer in "SQL Server Management Studio"

    Dear Team,
    "SQL Server Management Studio" is a fantastic IDE for the database.
    There are so many customization options available but one thing many users missing is that " How to change Font Size of Object Explorer?"
    Can you please accumulate this feature in IDE ASAP?
    Many Thanks,
    Bhavesh

    Its there
    Go to Tools -> Options
    Then under Environment you've fonts and colors tab where you can specify a higher font size.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Laserjet 200 color mfp change font

    How do I change the fonts?  I need to print labels and need to use a compressed print.  I cannot find the how to's in manual.  Is this done by a menu choice?  Driver?  Many thanks!!!

    Hi @jeepster217 ,
    I see that you would like to be able to change the font size to print. I would be happy to help you.
    You would have to set the font size from the application that you are printing from. The print driver doesn't have any options to change this setting.
    What is the full name and product number of your printer? How Do I Find My Model Number or Product Number?
    What application are you using?
    Have a nice day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • Change font in Adobe Acrobat Extended Pro

    I was wondering how I am able to change the font in Adobe Acrobat.  I know we can use the type writer, but how can I make it my own font, color and size? Please help! =)

    You cannot create fonts with Acrobat.
    Doing so requires a dedicated font creation application.
    Or purchas of Fonts to augment what the OS and applications install.
    To change fonts in a PDF to something else that is on the local machine and available to Acrobat you could try this:
    Select characters with the TouchUp Text too.
    Right click for the context menu.
    Select Properties.
    Select the Text tab.
    Look over the configuration options to see if they meet your needs.
    Be well...

  • Changing fonts in Mail

    Hi, can anyone tell me how to change fonts in MacMail when composing new messages?
    Thanks,
    Bob Tomsak

    Did anyone solve this? I want to permantntly both the change the font and color of the font in all of my outgoing messages. I've managed to change the font and size, but the color is still basic black. So for every message I have to go to the menu bar, select font/color and change it. I'm on email just about 6 hours a day, and really, really don't want to have to do it this way. PLEASE - advice on permanent changes?
    And what's with the "styles" button? There's no information on how to use anywhere that I've checked.

  • Configuring fonts in URxvt (with Infinality)

    I just installed Arch in a VirtualBox and so far everything's working well. I use xmonad with URxvt as my terminal emulator. I also installed Infinality. I chose the "combi" preset from Infinality.
    However, there is one thing that puzzles me. My ~/.Xresources looks like this:
    ! Xft settings ------------------------------------------------------------------
    Xft.dpi: 96
    Xft.antialias: true
    Xft.rgba: rgb
    Xft.hinting: true
    Xft.hintstyle: hintslight
    ! URxft settings ----------------------------------------------------------------
    URxvt*scrollBar: false
    URxvt*font: xft:Inconsolatazi4:pixelsize=16
    URxvt*boldFont: xft:Inconsolatazi4:bold:pixelsize=16
    The URxvt* settings work fine. However, changing the Xft.* settings does absolutely nothing to URxvt, yet it affects GTK applications (gVim and Emacs). Why is this so? I have a ~/.gtkrc-2.0 file created by lxappearance, yet .Xresources overrides it, but again, does nothing to URxvt (for example, setting Xft.antialias and Xft.hinting to false shows no difference in URxvt, but there's a world of difference in gVim). Why is this so?

    I can confirm this and changing the . -> * doesn't do anything. urxvt seems to be prefering the fontconfig DPI and antialias settings now and this was not the default behavior before (I don't think anyway. Although, I don't recall the last time that I edited the DPI info in my fontconfig settings). For instance, these are the relevant lines from .Xresources:
    Xft*dpi: 102
    Xft*antialias: 1
    Xft*rgba: rgb
    Xft*autohint: 0
    Xft*lcdfilter: lcddefault
    Xft*hinting: 1
    Xft*hintstyle: hintfull
    This helps GTK to behave the way that I want it to, but changes nothing in urxvt. But since urxvt is already doing what I want it to do, I didn't notice.
    By the way, I'm not using infinality. I am using all of the fonts from the bundle except for DejaVu* and DejaVu Sans Mono is what I'm testing against.
    Last edited by skottish (2015-01-08 18:18:14)

  • [SOLVED] Global Fonts Annihiliated

    Well the story starts off 2 days ago when I wanted to disable antialiasing and subpixel rendering (which makes the blue and red coloring on fonts) for fonts under a certain size. At the start I didn't know exactly what everything was so I follow the wikis for "Xorg Font Configuration" and "Fonts". I dont use a ~/.fonts, so all of my editting was done in the /etc/fonts/local.conf.
    Basically everything looks like this: http://omploader.org/vMmtjNg/NothingIsSpared.png
    Anti aliasing or something is totally missing from everything no matter what I do. I've used the template found at http://wiki.archlinux.org/index.php/Xor … _very_good into /etc/fonts/local.conf to no avail. I've reinstalled fonts, and fooled turning things off and on to see if it would make any difference and nothing has.
    I'm hoping a xorg or font guru can walk me through some things that could help improve my situtation.
    Last edited by Jimi (2009-10-23 04:17:14)

    Still haven't found a solution--Like I said all GTK apps are suffering from horrible fonts, while FireFox and urxvt are responding to /etc/fonts/local.conf and ~/.fonts.config
    I finally found the cairo-respect-fontconfig patch (i think), but i have no idea what to do with it
    #! /bin/sh /usr/share/dpatch/dpatch-run
    ## 04_lcd_filter.dpatch by Fabien Tassin <[email protected]>
    ## All lines beginning with `## DP:' are a description of the patch.
    ## DP: From git rev 5d887ad5dca5af0f8216830d1b04d08a5aba9bee
    @DPATCH@
    diff -urNad cairo-1.8.0~/src/cairo-font-options.c cairo-1.8.0/src/cairo-font-options.c
    --- cairo-1.8.0~/src/cairo-font-options.c 2008-09-25 22:30:14.000000000 +0200
    +++ cairo-1.8.0/src/cairo-font-options.c 2008-10-14 15:01:37.000000000 +0200
    @@ -39,6 +39,7 @@
    static const cairo_font_options_t _cairo_font_options_nil = {
    CAIRO_ANTIALIAS_DEFAULT,
    CAIRO_SUBPIXEL_ORDER_DEFAULT,
    + CAIRO_LCD_FILTER_DEFAULT,
    CAIRO_HINT_STYLE_DEFAULT,
    CAIRO_HINT_METRICS_DEFAULT
    @@ -54,6 +55,7 @@
    options->antialias = CAIRO_ANTIALIAS_DEFAULT;
    options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
    + options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
    options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
    options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
    @@ -64,6 +66,7 @@
    options->antialias = other->antialias;
    options->subpixel_order = other->subpixel_order;
    + options->lcd_filter = other->lcd_filter;
    options->hint_style = other->hint_style;
    options->hint_metrics = other->hint_metrics;
    @@ -189,6 +192,8 @@
    options->antialias = other->antialias;
    if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
    options->subpixel_order = other->subpixel_order;
    + if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
    + options->lcd_filter = other->lcd_filter;
    if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
    options->hint_style = other->hint_style;
    if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
    @@ -221,6 +226,7 @@
    return (options->antialias == other->antialias &&
    options->subpixel_order == other->subpixel_order &&
    + options->lcd_filter == other->lcd_filter &&
    options->hint_style == other->hint_style &&
    options->hint_metrics == other->hint_metrics);
    @@ -246,7 +252,8 @@
    return ((options->antialias) |
    (options->subpixel_order << 4) |
    - (options->hint_style << 8) |
    + (options->lcd_filter << 8) |
    + (options->hint_style << 12) |
    (options->hint_metrics << 16));
    slim_hidden_def (cairo_font_options_hash);
    @@ -328,6 +335,48 @@
    + * _cairo_font_options_set_lcd_filter:
    + * @options: a #cairo_font_options_t
    + * @lcd_filter: the new LCD filter
    + *
    + * Sets the LCD filter for the font options object. The LCD filter
    + * specifies how pixels are filtered when rendered with an antialiasing
    + * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for
    + * #cairo_lcd_filter_t for full details.
    + *
    + * Since: 1.8
    + **/
    +void
    +_cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
    + cairo_lcd_filter_t lcd_filter)
    +{
    + if (cairo_font_options_status (options))
    + return;
    +
    + options->lcd_filter = lcd_filter;
    +}
    +
    +/**
    + * _cairo_font_options_get_lcd_filter:
    + * @options: a #cairo_font_options_t
    + *
    + * Gets the LCD filter for the font options object.
    + * See the documentation for #cairo_lcd_filter_t for full details.
    + *
    + * Return value: the LCD filter for the font options object
    + *
    + * Since: 1.8
    + **/
    +cairo_lcd_filter_t
    +_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options)
    +{
    + if (cairo_font_options_status ((cairo_font_options_t *) options))
    + return CAIRO_LCD_FILTER_DEFAULT;
    +
    + return options->lcd_filter;
    +}
    +
    +/**
    * cairo_font_options_set_hint_style:
    * @options: a #cairo_font_options_t
    * @hint_style: the new hint style
    diff -urNad cairo-1.8.0~/src/cairo-ft-font.c cairo-1.8.0/src/cairo-ft-font.c
    --- cairo-1.8.0~/src/cairo-ft-font.c 2008-09-25 22:28:24.000000000 +0200
    +++ cairo-1.8.0/src/cairo-ft-font.c 2008-10-14 15:01:37.000000000 +0200
    @@ -57,6 +57,30 @@
    #include FT_SYNTHESIS_H
    #endif
    +#if HAVE_FT_LIBRARY_SETLCDFILTER
    +#include FT_LCD_FILTER_H
    +#endif
    +
    +/* Fontconfig version older than 2.6 didn't have these options */
    +#ifndef FC_LCD_FILTER
    +#define FC_LCD_FILTER "lcdfilter"
    +#endif
    +/* Some Ubuntu versions defined FC_LCD_FILTER without defining the following */
    +#ifndef FC_LCD_NONE
    +#define FC_LCD_NONE 0
    +#define FC_LCD_DEFAULT 1
    +#define FC_LCD_LIGHT 2
    +#define FC_LCD_LEGACY 3
    +#endif
    +
    +/* FreeType version older than 2.3.5(?) didn't have these options */
    +#ifndef FT_LCD_FILTER_NONE
    +#define FT_LCD_FILTER_NONE 0
    +#define FT_LCD_FILTER_DEFAULT 1
    +#define FT_LCD_FILTER_LIGHT 2
    +#define FT_LCD_FILTER_LEGACY 16
    +#endif
    +
    #define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
    #define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
    #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
    @@ -737,23 +761,286 @@
    return CAIRO_STATUS_SUCCESS;
    -/* Empirically-derived subpixel filtering values thanks to Keith
    - * Packard and libXft. */
    -static const int filters[3][3] = {
    - /* red */
    -#if 0
    - { 65538*4/7,65538*2/7,65538*1/7 },
    - /* green */
    - { 65536*1/4, 65536*2/4, 65537*1/4 },
    - /* blue */
    - { 65538*1/7,65538*2/7,65538*4/7 },
    +/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot
    + * into a different format. For example, we want to convert a
    + * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit
    + * ARGB or ABGR bitmap.
    + *
    + * this function prepares a target descriptor for this operation.
    + *
    + * input :: target bitmap descriptor. The function will set its
    + * 'width', 'rows' and 'pitch' fields, and only these
    + *
    + * slot :: the glyph slot containing the source bitmap. this
    + * function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP
    + *
    + * mode :: the requested final rendering mode. supported values are
    + * MONO, NORMAL (i.e. gray), LCD and LCD_V
    + *
    + * the function returns the size in bytes of the corresponding buffer,
    + * it's up to the caller to allocate the corresponding memory block
    + * before calling _fill_xrender_bitmap
    + *
    + * it also returns -1 in case of error (e.g. incompatible arguments,
    + * like trying to convert a gray bitmap into a monochrome one)
    + */
    +static int
    +_compute_xrender_bitmap_size(FT_Bitmap *target,
    + FT_GlyphSlot slot,
    + FT_Render_Mode mode)
    +{
    + FT_Bitmap *ftbit;
    + int width, height, pitch;
    +
    + if (slot->format != FT_GLYPH_FORMAT_BITMAP)
    + return -1;
    +
    + /* compute the size of the final bitmap */
    + ftbit = &slot->bitmap;
    +
    + width = ftbit->width;
    + height = ftbit->rows;
    + pitch = (width + 3) & ~3;
    +
    + switch (ftbit->pixel_mode) {
    + case FT_PIXEL_MODE_MONO:
    + if (mode == FT_RENDER_MODE_MONO) {
    + pitch = (((width + 31) & ~31) >> 3);
    + break;
    + }
    + /* fall-through */
    +
    + case FT_PIXEL_MODE_GRAY:
    + if (mode == FT_RENDER_MODE_LCD ||
    + mode == FT_RENDER_MODE_LCD_V)
    + {
    + /* each pixel is replicated into a 32-bit ARGB value */
    + pitch = width * 4;
    + }
    + break;
    +
    + case FT_PIXEL_MODE_LCD:
    + if (mode != FT_RENDER_MODE_LCD)
    + return -1;
    +
    + /* horz pixel triplets are packed into 32-bit ARGB values */
    + width /= 3;
    + pitch = width * 4;
    + break;
    +
    + case FT_PIXEL_MODE_LCD_V:
    + if (mode != FT_RENDER_MODE_LCD_V)
    + return -1;
    +
    + /* vert pixel triplets are packed into 32-bit ARGB values */
    + height /= 3;
    + pitch = width * 4;
    + break;
    +
    + default: /* unsupported source format */
    + return -1;
    + }
    +
    + target->width = width;
    + target->rows = height;
    + target->pitch = pitch;
    + target->buffer = NULL;
    +
    + return pitch * height;
    +}
    +
    +/* this functions converts the glyph bitmap found in a FT_GlyphSlot
    + * into a different format (see _compute_xrender_bitmap_size)
    + *
    + * you should call this function after _compute_xrender_bitmap_size
    + *
    + * target :: target bitmap descriptor. Note that its 'buffer' pointer
    + * must point to memory allocated by the caller
    + *
    + * slot :: the glyph slot containing the source bitmap
    + *
    + * mode :: the requested final rendering mode
    + *
    + * bgr :: boolean, set if BGR or VBGR pixel ordering is needed
    + */
    +static void
    +_fill_xrender_bitmap(FT_Bitmap *target,
    + FT_GlyphSlot slot,
    + FT_Render_Mode mode,
    + int bgr)
    +{
    + FT_Bitmap *ftbit = &slot->bitmap;
    + unsigned char *srcLine = ftbit->buffer;
    + unsigned char *dstLine = target->buffer;
    + int src_pitch = ftbit->pitch;
    + int width = target->width;
    + int height = target->rows;
    + int pitch = target->pitch;
    + int subpixel;
    + int h;
    +
    + subpixel = (mode == FT_RENDER_MODE_LCD ||
    + mode == FT_RENDER_MODE_LCD_V);
    +
    + if (src_pitch < 0)
    + srcLine -= src_pitch * (ftbit->rows - 1);
    +
    + target->pixel_mode = ftbit->pixel_mode;
    +
    + switch (ftbit->pixel_mode) {
    + case FT_PIXEL_MODE_MONO:
    + if (subpixel) {
    + /* convert mono to ARGB32 values */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
    + int x;
    +
    + for (x = 0; x < width; x++) {
    + if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
    + ((unsigned int *) dstLine)[x] = 0xffffffffU;
    + }
    + }
    + target->pixel_mode = FT_PIXEL_MODE_LCD;
    +
    + } else if (mode == FT_RENDER_MODE_NORMAL) {
    + /* convert mono to 8-bit gray */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
    + int x;
    +
    + for (x = 0; x < width; x++) {
    + if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
    + dstLine[x] = 0xff;
    + }
    + }
    + target->pixel_mode = FT_PIXEL_MODE_GRAY;
    +
    + } else {
    + /* copy mono to mono */
    +
    + int bytes = (width + 7) >> 3;
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
    + memcpy (dstLine, srcLine, bytes);
    + }
    + break;
    +
    + case FT_PIXEL_MODE_GRAY:
    + if (subpixel) {
    + /* convert gray to ARGB32 values */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
    + int x;
    + unsigned int *dst = (unsigned int *) dstLine;
    +
    + for (x = 0; x < width; x++) {
    + unsigned int pix = srcLine[x];
    +
    + pix |= (pix << 8);
    + pix |= (pix << 16);
    +
    + dst[x] = pix;
    + }
    + }
    + target->pixel_mode = FT_PIXEL_MODE_LCD;
    + } else {
    + /* copy gray into gray */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
    + memcpy (dstLine, srcLine, width);
    + }
    + break;
    +
    + case FT_PIXEL_MODE_LCD:
    + if (!bgr) {
    + /* convert horizontal RGB into ARGB32 */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
    + int x;
    + unsigned char *src = srcLine;
    + unsigned int *dst = (unsigned int *) dstLine;
    +
    + for (x = 0; x < width; x++, src += 3) {
    + unsigned int pix;
    +
    + pix = ((unsigned int)src[0] << 16) |
    + ((unsigned int)src[1] << 8) |
    + ((unsigned int)src[2] ) |
    + ((unsigned int)src[1] << 24) ;
    +
    + dst[x] = pix;
    + }
    + }
    + } else {
    + /* convert horizontal BGR into ARGB32 */
    +
    + for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
    +
    + int x;
    + unsigned char *src = srcLine;
    + unsigned int *dst = (unsigned int *) dstLine;
    +
    + for (x = 0; x < width; x++, src += 3) {
    + unsigned int pix;
    +
    + pix = ((unsigned int)src[2] << 16) |
    + ((unsigned int)src[1] << 8) |
    + ((unsigned int)src[0] ) |
    + ((unsigned int)src[1] << 24) ;
    +
    + dst[x] = pix;
    + }
    + }
    + }
    + break;
    +
    + default: /* FT_PIXEL_MODE_LCD_V */
    + /* convert vertical RGB into ARGB32 */
    + if (!bgr) {
    +
    + for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) {
    + int x;
    + unsigned char* src = srcLine;
    + unsigned int* dst = (unsigned int *) dstLine;
    +
    + for (x = 0; x < width; x++, src += 1) {
    + unsigned int pix;
    +#if 1
    + pix = ((unsigned int)src[0] << 16) |
    + ((unsigned int)src[src_pitch] << 8) |
    + ((unsigned int)src[src_pitch*2] ) |
    + 0xFF000000 ;
    +#else
    + pix = ((unsigned int)src[0] << 16) |
    + ((unsigned int)src[src_pitch] << 8) |
    + ((unsigned int)src[src_pitch*2] ) |
    + ((unsigned int)src[src_pitch] << 24) ;
    #endif
    - { 65538*9/13,65538*3/13,65538*1/13 },
    - /* green */
    - { 65538*1/6, 65538*4/6, 65538*1/6 },
    - /* blue */
    - { 65538*1/13,65538*3/13,65538*9/13 },
    + dst[x] = pix;
    + }
    + }
    + } else {
    +
    + for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) {
    + int x;
    + unsigned char *src = srcLine;
    + unsigned int *dst = (unsigned int *) dstLine;
    +
    + for (x = 0; x < width; x++, src += 1) {
    + unsigned int pix;
    +
    + pix = ((unsigned int)src[src_pitch * 2] << 16) |
    + ((unsigned int)src[src_pitch] << 8) |
    + ((unsigned int)src[0] ) |
    + ((unsigned int)src[src_pitch] << 24) ;
    +
    + dst[x] = pix;
    + }
    + }
    + }
    + }
    +}
    +
    /* Fills in val->image with an image surface created from @bitmap
    @@ -766,7 +1053,7 @@
    int width, height, stride;
    unsigned char *data;
    int format = CAIRO_FORMAT_A8;
    - cairo_bool_t subpixel = FALSE;
    + cairo_image_surface_t *image;
    width = bitmap->width;
    height = bitmap->rows;
    @@ -823,11 +1110,7 @@
    case FT_PIXEL_MODE_LCD:
    case FT_PIXEL_MODE_LCD_V:
    case FT_PIXEL_MODE_GRAY:
    - switch (font_options->antialias) {
    - case CAIRO_ANTIALIAS_DEFAULT:
    - case CAIRO_ANTIALIAS_GRAY:
    - case CAIRO_ANTIALIAS_NONE:
    - default:
    + if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
    stride = bitmap->pitch;
    if (own_buffer) {
    data = bitmap->buffer;
    @@ -839,104 +1122,16 @@
    memcpy (data, bitmap->buffer, stride * height);
    format = CAIRO_FORMAT_A8;
    - break;
    - case CAIRO_ANTIALIAS_SUBPIXEL: {
    - int x, y;
    - unsigned char *in_line, *out_line, *in;
    - unsigned int *out;
    - unsigned int red, green, blue;
    - int rf, gf, bf;
    - int s;
    - int o, os;
    - unsigned char *data_rgba;
    - unsigned int width_rgba, stride_rgba;
    - int vmul = 1;
    - int hmul = 1;
    + } else {
    + /* if we get there, the data from the source bitmap
    + * really comes from _fill_xrender_bitmap, and is
    + * made of 32-bit ARGB or ABGR values */
    + assert (own_buffer != 0);
    + assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
    - switch (font_options->subpixel_order) {
    - case CAIRO_SUBPIXEL_ORDER_DEFAULT:
    - case CAIRO_SUBPIXEL_ORDER_RGB:
    - case CAIRO_SUBPIXEL_ORDER_BGR:
    - default:
    - width /= 3;
    - hmul = 3;
    - break;
    - case CAIRO_SUBPIXEL_ORDER_VRGB:
    - case CAIRO_SUBPIXEL_ORDER_VBGR:
    - vmul = 3;
    - height /= 3;
    - break;
    - * Filter the glyph to soften the color fringes
    - width_rgba = width;
    + data = bitmap->buffer;
    stride = bitmap->pitch;
    - stride_rgba = (width_rgba * 4 + 3) & ~3;
    - data_rgba = calloc (stride_rgba, height);
    - if (data_rgba == NULL) {
    - if (own_buffer)
    - free (bitmap->buffer);
    - return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    - os = 1;
    - switch (font_options->subpixel_order) {
    - case CAIRO_SUBPIXEL_ORDER_VRGB:
    - os = stride;
    - case CAIRO_SUBPIXEL_ORDER_DEFAULT:
    - case CAIRO_SUBPIXEL_ORDER_RGB:
    - default:
    - rf = 0;
    - gf = 1;
    - bf = 2;
    - break;
    - case CAIRO_SUBPIXEL_ORDER_VBGR:
    - os = stride;
    - case CAIRO_SUBPIXEL_ORDER_BGR:
    - bf = 0;
    - gf = 1;
    - rf = 2;
    - break;
    - in_line = bitmap->buffer;
    - out_line = data_rgba;
    - for (y = 0; y < height; y++)
    - in = in_line;
    - out = (unsigned int *) out_line;
    - in_line += stride * vmul;
    - out_line += stride_rgba;
    - for (x = 0; x < width * hmul; x += hmul)
    - red = green = blue = 0;
    - o = 0;
    - for (s = 0; s < 3; s++)
    - red += filters[rf][s]*in[x+o];
    - green += filters[gf][s]*in[x+o];
    - blue += filters[bf][s]*in[x+o];
    - o += os;
    - red = red / 65536;
    - green = green / 65536;
    - blue = blue / 65536;
    - *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
    - /* Images here are stored in native format. The
    - * backend must convert to its own format as needed
    - if (own_buffer)
    - free (bitmap->buffer);
    - data = data_rgba;
    - stride = stride_rgba;
    format = CAIRO_FORMAT_ARGB32;
    - subpixel = TRUE;
    - break;
    break;
    case FT_PIXEL_MODE_GRAY2:
    @@ -948,19 +1143,20 @@
    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    - *surface = (cairo_image_surface_t *)
    + /* XXX */
    + *surface = image = (cairo_image_surface_t *)
    cairo_image_surface_create_for_data (data,
    format,
    width, height, stride);
    - if ((*surface)->base.status) {
    + if (image->base.status) {
    free (data);
    return (*surface)->base.status;
    - if (subpixel)
    - pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
    + if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL)
    + pixman_image_set_component_alpha (image->pixman_image, TRUE);
    - _cairo_image_surface_assume_ownership_of_data ((*surface));
    + _cairo_image_surface_assume_ownership_of_data (image);
    return CAIRO_STATUS_SUCCESS;
    @@ -985,16 +1181,59 @@
    cairo_font_options_t *font_options,
    cairo_image_surface_t **surface)
    + int rgba = FC_RGBA_UNKNOWN;
    + int lcd_filter = FT_LCD_FILTER_LEGACY;
    FT_GlyphSlot glyphslot = face->glyph;
    FT_Outline *outline = &glyphslot->outline;
    FT_Bitmap bitmap;
    FT_BBox cbox;
    - FT_Matrix matrix;
    - int hmul = 1;
    - int vmul = 1;
    - unsigned int width, height, stride;
    - cairo_bool_t subpixel = FALSE;
    + unsigned int width, height;
    cairo_status_t status;
    + FT_Error fterror;
    + FT_Library library = glyphslot->library;
    + FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL;
    +
    + switch (font_options->antialias) {
    + case CAIRO_ANTIALIAS_NONE:
    + render_mode = FT_RENDER_MODE_MONO;
    + break;
    +
    + case CAIRO_ANTIALIAS_SUBPIXEL:
    + switch (font_options->subpixel_order) {
    + case CAIRO_SUBPIXEL_ORDER_DEFAULT:
    + case CAIRO_SUBPIXEL_ORDER_RGB:
    + case CAIRO_SUBPIXEL_ORDER_BGR:
    + render_mode = FT_RENDER_MODE_LCD;
    + break;
    +
    + case CAIRO_SUBPIXEL_ORDER_VRGB:
    + case CAIRO_SUBPIXEL_ORDER_VBGR:
    + render_mode = FT_RENDER_MODE_LCD_V;
    + break;
    + }
    +
    + switch (font_options->lcd_filter) {
    + case CAIRO_LCD_FILTER_NONE:
    + lcd_filter = FT_LCD_FILTER_NONE;
    + break;
    + case CAIRO_LCD_FILTER_DEFAULT:
    + case CAIRO_LCD_FILTER_INTRA_PIXEL:
    + lcd_filter = FT_LCD_FILTER_LEGACY;
    + break;
    + case CAIRO_LCD_FILTER_FIR3:
    + lcd_filter = FT_LCD_FILTER_LIGHT;
    + break;
    + case CAIRO_LCD_FILTER_FIR5:
    + lcd_filter = FT_LCD_FILTER_DEFAULT;
    + break;
    + }
    +
    + break;
    +
    + case CAIRO_ANTIALIAS_DEFAULT:
    + case CAIRO_ANTIALIAS_GRAY:
    + render_mode = FT_RENDER_MODE_NORMAL;
    + }
    FT_Outline_Get_CBox (outline, &cbox);
    @@ -1005,20 +1244,21 @@
    width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
    - stride = (width * hmul + 3) & ~3;
    if (width * height == 0) {
    cairo_format_t format;
    /* Looks like fb handles zero-sized images just fine */
    - switch (font_options->antialias) {
    - case CAIRO_ANTIALIAS_NONE:
    + switch (render_mode) {
    + case FT_RENDER_MODE_MONO:
    format = CAIRO_FORMAT_A1;
    break;
    - case CAIRO_ANTIALIAS_SUBPIXEL:
    + case FT_RENDER_MODE_LCD:
    + case FT_RENDER_MODE_LCD_V:
    format= CAIRO_FORMAT_ARGB32;
    break;
    - case CAIRO_ANTIALIAS_DEFAULT:
    - case CAIRO_ANTIALIAS_GRAY:
    + case FT_RENDER_MODE_LIGHT:
    + case FT_RENDER_MODE_NORMAL:
    + case FT_RENDER_MODE_MAX:
    default:
    format = CAIRO_FORMAT_A8;
    break;
    @@ -1030,73 +1270,73 @@
    return (*surface)->base.status;
    } else {
    - matrix.xx = matrix.yy = 0x10000L;
    - matrix.xy = matrix.yx = 0;
    + int bitmap_size;
    - switch (font_options->antialias) {
    - case CAIRO_ANTIALIAS_NONE:
    - bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
    - bitmap.num_grays = 1;
    - stride = ((width + 31) & -32) >> 3;
    - break;
    - case CAIRO_ANTIALIAS_DEFAULT:
    - case CAIRO_ANTIALIAS_GRAY:
    - bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
    - bitmap.num_grays = 256;
    - stride = (width + 3) & -4;
    + switch (render_mode) {
    + case FT_RENDER_MODE_LCD:
    + if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) {
    + rgba = FC_RGBA_BGR;
    + } else {
    + rgba = FC_RGBA_RGB;
    + }
    break;
    - case CAIRO_ANTIALIAS_SUBPIXEL:
    - switch (font_options->subpixel_order) {
    - case CAIRO_SUBPIXEL_ORDER_RGB:
    - case CAIRO_SUBPIXEL_ORDER_BGR:
    - case CAIRO_SUBPIXEL_ORDER_DEFAULT:
    - default:
    - matrix.xx *= 3;
    - hmul = 3;
    - subpixel = TRUE;
    - break;
    - case CAIRO_SUBPIXEL_ORDER_VRGB:
    - case CAIRO_SUBPIXEL_ORDER_VBGR:
    - matrix.yy *= 3;
    - vmul = 3;
    - subpixel = TRUE;
    - break;
    + case FT_RENDER_MODE_LCD_V:
    + if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) {
    + rgba = FC_RGBA_VBGR;
    + } else {
    + rgba = FC_RGBA_VRGB;
    - FT_Outline_Transform (outline, &matrix);
    - bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
    - bitmap.num_grays = 256;
    - stride = (width * hmul + 3) & -4;
    + break;
    + case FT_RENDER_MODE_MONO:
    + case FT_RENDER_MODE_LIGHT:
    + case FT_RENDER_MODE_NORMAL:
    + case FT_RENDER_MODE_MAX:
    + default:
    + break;
    - bitmap.pitch = stride;
    - bitmap.width = width * hmul;
    - bitmap.rows = height * vmul;
    - bitmap.buffer = calloc (stride, bitmap.rows);
    - if (bitmap.buffer == NULL)
    +#if HAVE_FT_LIBRARY_SETLCDFILTER
    + FT_Library_SetLcdFilter (library, lcd_filter);
    +#endif
    +
    + fterror = FT_Render_Glyph (face->glyph, render_mode);
    +
    +#if HAVE_FT_LIBRARY_SETLCDFILTER
    + FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE);
    +#endif
    +
    + if (fterror != 0)
    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    - FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
    + bitmap_size = _compute_xrender_bitmap_size (&bitmap,
    + face->glyph,
    + render_mode);
    + if (bitmap_size < 0)
    + return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    - if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
    - free (bitmap.buffer);
    + bitmap.buffer = calloc (1, bitmap_size);
    + if (bitmap.buffer == NULL)
    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    + _fill_xrender_bitmap (&bitmap, face->glyph, render_mode,
    + (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR));
    +
    + /* Note:
    + * _get_bitmap_surface will free bitmap.buffer if there is an error
    + */
    status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
    if (status)
    return status;
    - * Note: the font's coordinate system is upside down from ours, so the
    - * Y coordinate of the control box needs to be negated. Moreover, device
    - * offsets are position of glyph origin relative to top left while xMin
    - * and yMax are offsets of top left relative to origin. Another negation.
    - cairo_surface_set_device_offset (&(*surface)->base,
    - floor (-(double) cbox.xMin / 64.0),
    - floor (+(double) cbox.yMax / 64.0));
    + /* Note: the font's coordinate system is upside down from ours, so the
    + * Y coordinate of the control box needs to be negated. Moreover, device
    + * offsets are position of glyph origin relative to top left while xMin
    + * and yMax are offsets of top left relative to origin. Another negation.
    + */
    + cairo_surface_set_device_offset (&(*surface)->base,
    + (double)-glyphslot->bitmap_left,
    + (double)+glyphslot->bitmap_top);
    + }
    return CAIRO_STATUS_SUCCESS;
    @@ -1316,6 +1556,7 @@
    if (antialias) {
    cairo_subpixel_order_t subpixel_order;
    + int lcd_filter;
    /* disable hinting if requested */
    if (FcPatternGetBool (pattern,
    @@ -1351,6 +1592,25 @@
    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
    + if (FcPatternGetInteger (pattern,
    + FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
    + {
    + switch (lcd_filter) {
    + case FC_LCD_NONE:
    + ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
    + break;
    + case FC_LCD_DEFAULT:
    + ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
    + break;
    + case FC_LCD_LIGHT:
    + ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
    + break;
    + case FC_LCD_LEGACY:
    + ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
    + break;
    + }
    + }
    +
    #ifdef FC_HINT_STYLE
    if (FcPatternGetInteger (pattern,
    FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
    @@ -1451,6 +1711,12 @@
    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
    options->base.hint_style = CAIRO_HINT_STYLE_NONE;
    + if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
    + options->base.lcd_filter = other->base.lcd_filter;
    +
    + if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
    + options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
    +
    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
    if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
    load_flags |= FT_LOAD_NO_HINTING;
    @@ -1474,11 +1740,11 @@
    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
    case CAIRO_SUBPIXEL_ORDER_RGB:
    case CAIRO_SUBPIXEL_ORDER_BGR:
    - load_target |= FT_LOAD_TARGET_LCD;
    + load_target = FT_LOAD_TARGET_LCD;
    break;
    case CAIRO_SUBPIXEL_ORDER_VRGB:
    case CAIRO_SUBPIXEL_ORDER_VBGR:
    - load_target |= FT_LOAD_TARGET_LCD_V;
    + load_target = FT_LOAD_TARGET_LCD_V;
    break;
    @@ -2421,6 +2687,34 @@
    + if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
    + {
    + if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch)
    + {
    + int lcd_filter;
    +
    + switch (options->lcd_filter) {
    + case CAIRO_LCD_FILTER_NONE:
    + lcd_filter = FT_LCD_FILTER_NONE;
    + break;
    + case CAIRO_LCD_FILTER_DEFAULT:
    + case CAIRO_LCD_FILTER_INTRA_PIXEL:
    + lcd_filter = FT_LCD_FILTER_LEGACY;
    + break;
    + case CAIRO_LCD_FILTER_FIR3:
    + lcd_filter = FT_LCD_FILTER_LIGHT;
    + break;
    + default:
    + case CAIRO_LCD_FILTER_FIR5:
    + lcd_filter = FT_LCD_FILTER_DEFAULT;
    + break;
    + }
    +
    + if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter))
    + return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    + }
    + }
    +
    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
    if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
    diff -urNad cairo-1.8.0~/src/cairo-surface.c cairo-1.8.0/src/cairo-surface.c
    --- cairo-1.8.0~/src/cairo-surface.c 2008-09-25 22:28:56.000000000 +0200
    +++ cairo-1.8.0/src/cairo-surface.c 2008-10-14 15:01:37.000000000 +0200
    @@ -73,6 +73,7 @@
    FALSE, /* has_font_options */ \
    { CAIRO_ANTIALIAS_DEFAULT, /* antialias */ \
    CAIRO_SUBPIXEL_ORDER_DEFAULT, /* subpixel_order */ \
    + CAIRO_LCD_FILTER_DEFAULT, /* lcd_filter */ \
    CAIRO_HINT_STYLE_DEFAULT, /* hint_style */ \
    CAIRO_HINT_METRICS_DEFAULT /* hint_metrics */ \
    } /* font_options */ \
    diff -urNad cairo-1.8.0~/src/cairo-types-private.h cairo-1.8.0/src/cairo-types-private.h
    --- cairo-1.8.0~/src/cairo-types-private.h 2008-09-25 22:29:06.000000000 +0200
    +++ cairo-1.8.0/src/cairo-types-private.h 2008-10-14 15:01:37.000000000 +0200
    @@ -113,9 +113,35 @@
    cairo_bool_t is_snapshot;
    +
    +/**
    + * cairo_lcd_filter_t:
    + * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for
    + * font backend and target device
    + * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering
    + * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter
    + * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel
    + * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel
    + *
    + * The LCD filter specifies the low-pass filter applied to LCD-optimized
    + * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
    + *
    + * Note: This API was temporarily made available in the public
    + * interface during the 1.7.x development series, but was made private
    + * before 1.8.
    + **/
    +typedef enum _cairo_lcd_filter {
    + CAIRO_LCD_FILTER_DEFAULT,
    + CAIRO_LCD_FILTER_NONE,
    + CAIRO_LCD_FILTER_INTRA_PIXEL,
    + CAIRO_LCD_FILTER_FIR3,
    + CAIRO_LCD_FILTER_FIR5
    +} cairo_lcd_filter_t;
    +
    struct _cairo_font_options {
    cairo_antialias_t antialias;
    cairo_subpixel_order_t subpixel_order;
    + cairo_lcd_filter_t lcd_filter;
    cairo_hint_style_t hint_style;
    cairo_hint_metrics_t hint_metrics;
    diff -urNad cairo-1.8.0~/src/cairo-xlib-screen.c cairo-1.8.0/src/cairo-xlib-screen.c
    --- cairo-1.8.0~/src/cairo-xlib-screen.c 2008-09-25 22:29:39.000000000 +0200
    +++ cairo-1.8.0/src/cairo-xlib-screen.c 2008-10-14 15:01:37.000000000 +0200
    @@ -150,13 +150,22 @@
    cairo_bool_t xft_antialias;
    int xft_hintstyle;
    int xft_rgba;
    + int xft_lcdfilter;
    cairo_antialias_t antialias;
    cairo_subpixel_order_t subpixel_order;
    + cairo_lcd_filter_t lcd_filter;
    cairo_hint_style_t hint_style;
    if (!get_boolean_default (dpy, "antialias", &xft_antialias))
    xft_antialias = TRUE;
    + if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) {
    + /* -1 is an non-existant Fontconfig constant used to differentiate
    + * the case when no lcdfilter property is available.
    + */
    + xft_lcdfilter = -1;
    + }
    +
    if (!get_boolean_default (dpy, "hinting", &xft_hinting))
    xft_hinting = TRUE;
    @@ -239,6 +248,24 @@
    subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
    + switch (xft_lcdfilter) {
    + case FC_LCD_NONE:
    + lcd_filter = CAIRO_LCD_FILTER_NONE;
    + break;
    + case FC_LCD_DEFAULT:
    + lcd_filter = CAIRO_LCD_FILTER_FIR5;
    + break;
    + case FC_LCD_LIGHT:
    + lcd_filter = CAIRO_LCD_FILTER_FIR3;
    + break;
    + case FC_LCD_LEGACY:
    + lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
    + break;
    + default:
    + lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
    + break;
    + }
    +
    if (xft_antialias) {
    if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT)
    antialias = CAIRO_ANTIALIAS_GRAY;
    @@ -251,6 +278,7 @@
    cairo_font_options_set_hint_style (&info->font_options, hint_style);
    cairo_font_options_set_antialias (&info->font_options, antialias);
    cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order);
    + _cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter);
    cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON);
    diff -urNad cairo-1.8.0~/src/cairoint.h cairo-1.8.0/src/cairoint.h
    --- cairo-1.8.0~/src/cairoint.h 2008-09-26 00:56:48.000000000 +0200
    +++ cairo-1.8.0/src/cairoint.h 2008-10-14 15:01:37.000000000 +0200
    @@ -1336,6 +1336,13 @@
    _cairo_font_options_init_copy (cairo_font_options_t *options,
    const cairo_font_options_t *other);
    +cairo_private void
    +_cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
    + cairo_lcd_filter_t lcd_filter);
    +
    +cairo_private cairo_lcd_filter_t
    +_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options);
    +
    /* cairo-hull.c */
    cairo_private cairo_status_t
    _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
    Last edited by Jimi (2009-10-21 23:00:23)

Maybe you are looking for

  • I can't reinstall Windows Xp pro SP3 from installation disk on my IBM Thinkpad T40

    Dear folk, I have bought used IBM Thinkpad t40 in Germany. It has Windows XP in German, wich works well but it makes some dificulties while I am using some functions. I decided to reinstall Windows XP Pro in English. My Windows XP Pro CD instructed m

  • Synchronous and asynchronous processes communication in WLI 8.1

    Hi all, I'm using workshop with WL 8.1 to design by business processes. I have created one process which is invoked synchronously via a client request with return. Than I call this process in web flow. The process publishes message in the MB, which c

  • Strange issue in Webi Reports

    Hi, I have a Webi Report created on SAP BW Hierarchy Query -- BW 7.01 SP05 and this report is working fine. Then i have imported this report to another BO system having the same version BOE XI 3.1 SP1. But after import the Webi report is not working

  • How do you add the contact who sent out a group text?

    How do you add the contact who sent out a group text? Also, how do you reply to the sender without having to reply to everyone in the group text? Thanks

  • Wrong german umlauts

    Hi, we are using PI/7.0 and a customer uses XI/3.0 - we have the same SWCV installed on the machines. The solution sends mails via java-mail  - not via mail adpter of XI/PI. We are sending IDocs from R/3 to XI and the solution sends mails via java-ma