Announcement

Collapse
No announcement yet.

HOWTO: Installing Japanese Input & Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    HOWTO: Installing Japanese Input & Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

    Installing Japanese Input and Superior Font Setup in Kubuntu

    Introduction

    This is a guide to setting up Japanese for Kubuntu 8.10 Intrepid. It is intended as a complete guide encompassing all elements required for using Japanese on any language installation of Kubuntu. It covers input (SKIM-Anthy) and configuring the Japanese fonts. There are other guides around for older versions of Kubuntu or Ubuntu or that use the alternatives, some of which no longer work. This guide is intended to cover everything. Please note that Ubuntu requires slightly different steps. Please follow the relevant page accordingly. This is an updated version based on the original 6.10 (Ubuntu) one, but with some sections changed. Please note that if you follow this guide, your fonts will be reconfigured. This might mean losing some font settings you may have made. With each version of Kubuntu, there are certain changes, this guide is not the same as the 8.04 version.

    Issues Involved

    There are two main issues here:

    1.Installing the SKIM input system that will work in a locale other than converting your whole install to Japanese, i.e. you want Japanese input in an English login.

    2.The fonts look initially terrible. Therefore a certain amount of customisation is required to make all the Kanji's render in the same style and Hiragana & Katakana to render in a matching style.

    Japanese Input with SKIM

    This section covers setting up the Japanese input system using SKIM Anthy. This involves, downloading, installing and configuring it so that you can use it in non-Japanese locales (e.g. your system is in English).

    Setting Up Repositories

    First lets make sure you have the correct repositories installed in order to automatically download the relevant packs. Make sure you have the Universe and Multiverse repositories switched on. This can be done in 'Adept Package Manager' under the sources tab. Also, you need the Japanese repository too. Open the repositories list file:

    Code:
    kdesudo kate /etc/apt/sources.list
    Add the following line at the bottom:

    Code:
    deb [url]http://archive.ubuntulinux.jp/ubuntu-ja[/url] intrepid/
    Note that you will need to change 'intrepid' if you are using a different version from 8.10. Now update your repos with:

    Code:
    sudo apt-get update
    At this stage, you will probably get an error saying that the repository is not validated. Ignore this for now. The following step will correct it. After adding the repository and running the update, you also need to add a keyring for the new location:

    Code:
    sudo apt-get install ubuntu-ja-keyring
    Adding Kbuntu Language Support

    Go into System Settings / Regional & Language. Click on the 'Install New Language' button, then select Japanese. Kubuntu will download some packages for you. Click on 'Select System Language' and make sure that your native language is selected (e.g. English). Also make you've also turned on support for inputting complex characters. Click on 'Add Language' and select your native language (e.g. English). DO NOT ADD JAPANESE. If you do it will start converting your menus and other things into Japanese too. You cannot at time of writing demote Japanese to secondary language. You don't need Japanese here for other things to work properly. This should install the basics.

    Making SKIM available under a non-Japanese login


    Now you want to make SCIM (Language input system) available in your English (or other language) login and not just the Japanese one. Since the introduction of KDE 4, things have changed a bit.

    Open the Konsole and type:

    Code:
    im-switch -s skim
    Now go into System Settings / Advanced / Autostart. Click on 'Add Program'. When prompted, just type 'skim' and click OK. This will instruct KDE to run SKIM at startup. Save any changes.

    Now you need to configure SKIM-SCIM to run correctly under KDE.

    Code:
    kate ~/.scim/global
    Add the lines:
    Code:
    /DefaultConfigModule = kconfig
    /DefaultPanelProgram = /usr/bin/scim-panel-kde
    /SupportedUnicodeLocales = en_US.UTF-8,en_GB.UTF-8
    The above line adds support for US and UK locales. If you are using a different locale, you will need to change / add the relevant locale. You can find out the name of your current locale by entering:

    Code:
    locale
    In my case (UK) it returns LANG=en_GB.UTF-8. Add the necessary to the above line.

    IMPORTANT NOTE: SCIM is very unforgiving with this line. Note that there is NO SPACE between the "," and "en_GB". If you put a space there, it will ignore everything after. Therefore make sure the following locales are separated by a comma only.

    At this stage you'll probably need to log out and back in again. Open a text editor and hit ctrl+space. SKIM should pop up ready to type in Japanese.

    Adding handwriting recognition support for looking up Kanjis

    Sadly at the time of writing there is no 64-bit package for Tomoe available in the repositories yet. We wait in hope. 32-bit one works fine though. After adding the above repository, you should be able to install the 'Tomoe' handwriting recognition addon for scim (which runs in SKIM) using:

    Code:
    sudo apt-get install scim-tomoe
    Unfortunately, Tomoe is set to load dictionaries that correspond to the locale, so if you're not using a Japanese locale, you'll need to create a link to the dictionary manually.

    Code:
    cd /usr/share/tomoe/recognizer
    sudo cp handwriting-ja.xml handwriting-en.xml
    Where 'en' corresponds to your locale type. In my case (en_GB.UTF- it is 'en'. For you, it might be different. You can look it up as mentioned above.

    Now that Tomoe is installed, it is accessible on the SCIM menu under the 'SCIM Command Menu' and listed as 'Handwriting recognition'. But in KDE, under SKIM, we don't have access to that menu. We can instead right click on the SKIM icon in the system tray and select 'Handwriting recognition'

    Setting up the system to display Japanese characters properly

    OK, now you've got Japanese input installed (hopefully). It might require rebooting xwindows (CTRL+ALT+Backspace). But for me, I really didn't like the horrible fonts that defaulted. Particularly the fact that hiragana / katakana characters are rendered differently from kanjis and the poor quality of smaller sizes annoys me. The main reason for this is that the fonts provided do not always have a full set of kanjis, with default settings the kanjis are rendered as bitmaps and the hiragana and katakana as vectors.

    At lower font sizes, it would be impossible to render all the strokes in very complicated characters without blurring and this causes a readability problem. This can be overcome with bitmap alternatives at a low end. Certain strokes are omitted and the shape is actually changed in order to improve readability. It's not simply a case of rendering the same vector in a smaller size. Some true type fonts contain bitmap alternatives that can be automatically substituted at the low end. This is a common approach and is adopted by Windows, MacOS and other electronic devices in Asia such as mobile phones. Here's the next step.

    Downloading External Fonts

    Unfortunately, I am very disappointed in the Kubuntu selection and you will almost certainly want this to be changed to MSGothic and MSMincho. They contain a superior vector and bitmap selection. These are Microsoft fonts, but they are freely available to use and are actually from a company called Ricoh. They need to be downloaded and installed manually. They can be found at the following page.

    http://www.linux.ryukent.co.uk/show.php?id=24

    So download and extract the files and you need to copy them into the fonts directory. This will need root privileges.

    Code:
    sudo mkdir /usr/share/fonts/truetype/msjapanesefonts
    Make sure you're in the directory where the unzipped files are sitting, then run

    Code:
    sudo cp MSGOTHIC.TTF /usr/share/fonts/truetype/msjapanesefonts/
    sudo cp MSMINCHO.TTF /usr/share/fonts/truetype/msjapanesefonts/
    Rebuilding the font cache

    Now we need to rebuild the fonts cache:

    Code:
    sudo fc-cache -f -v
    Setting up the font order

    OK, so that might well be enough, but I think you'll probably still have your Japanese fonts not running at optimum and the default might be a little ugly. Lets set up the order in which we like the fonts to be selected. Open the “.fonts.conf” file in your home directory:

    Code:

    Code:
    kate ~/.fonts.conf
    It should read as follows:

    Code:
    <?xml version="1.0"?>
    <fontconfig>
     <alias>
     <family>serif</family>
     <prefer>
     <family>DejaVu Serif</family>
     <family>Times New Roman</family>
     <family>MS 明朝</family>
     <family>IPAPMincho</family>
     <family>Sazanami Mincho</family>
     <family>Kochi Mincho</family>
     <family>Bitstream Vera Serif</family>
     <family>Thorndale AMT</family>
     <family>Luxi Serif</family>
     <family>Nimbus Roman No9 L</family>
     <family>Times</family>
     <family>Frank Ruehl</family>
     <family>MgOpen Canonica</family>
     <family>AR PL SungtiL GB</family>
     <family>AR PL Mingti2L Big5</family>
     <family>FreeSerif</family>
     <family>Baekmuk Batang</family>
     </prefer>
     </alias>
     <alias>
     <family>sans-serif</family>
     <prefer>
     <family>DejaVu Sans</family>
     <family>Verdana</family>
     <family>MS ゴシック</family>
     <family>IPAPGothic</family>
     <family>Sazanami Gothic</family>
     <family>Kochi Gothic</family>
     <family>Bitstream Vera Sans</family>
     <family>Arial</family>
     <family>Albany AMT</family>
     <family>Luxi Sans</family>
     <family>Nimbus Sans L</family>
     <family>Helvetica</family>
     <family>Nachlieli</family>
     <family>MgOpen Moderna</family>
     <family>AR PL KaitiM GB</family>
     <family>AR PL KaitiM Big5</family>
     <family>FreeSans</family>
     <family>Baekmuk Dotum</family>
     <family>SimSun</family>
     </prefer>
     </alias>
     <alias>
     <family>monospace</family>
     <prefer>
     <family>DejaVu Sans Mono</family>
     <family>Courier New</family>
     <family>MS ゴシック</family>
     <family>IPAGothic</family>
     <family>Sazanami Gothic</family>
     <family>Kochi Gothic</family>
     <family>Bitstream Vera Sans Mono</family>
     <family>Andale Mono</family>
     <family>Cumberland AMT</family>
     <family>Luxi Mono</family>
     <family>Nimbus Mono L</family>
     <family>Courier</family>
     <family>Miriam Mono</family>
     <family>FreeMono</family>
     <family>AR PL KaitiM GB</family>
     <family>Baekmuk Dotum</family>
     </prefer>
     </alias>
     <match target="font" >
     <edit mode="assign" name="embeddedbitmap" >
     <bool>true</bool>
     </edit>
     </match>
    </fontconfig>
    So, save the file and reboot xwindows (CTLR+ALT+Backspace). Now with any luck the order of fonts should have been updated so that the default Japanese type face is actually a clean one first and foremost instead of the ugly first serving. Also it enables the built in bitmap font which can really make kanjis more readable and also enables the bitmap version of hiragana and katakana so that they don't look blurry anti-aliased next to clear bitmap kanjis. For most people this setting will be fine. If you're not happy, by all means leave out the embeddedbitmap setting or change it to false.

    To finish things off, I'd suggest making sure in System Settings / Appearance / Fonts, you've got anti-aliasing enabled with subpixel smoothing on and hinting set to 'full'.

    If you have any additional questions, please don't hesitate to message me in this forum. I'm always happy to help, though I make take a little while responding. 頑張ってください - RyuKent

    #2
    Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

    Hi,

    Great guide. I already have Skim setup and working but I wanted to improve the display of Kanji characters. I dl'd and installed the MS fonts, moved them to the font folder as instructed in you post but I don't have a /.fonts.conf file resembling anything like yours.

    Code:
    <?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    <fontconfig>
     <match target="font" >
     <edit mode="assign" name="rgba" >
      <const>none</const>
     </edit>
     </match>
     <match target="font" >
     <edit mode="assign" name="hinting" >
      <bool>true</bool>
     </edit>
     </match>
     <match target="font" >
     <edit mode="assign" name="hintstyle" >
      <const>hintfull</const>
     </edit>
     </match>
     <match target="font" >
     <edit mode="assign" name="antialias" >
      <bool>true</bool>
     </edit>
     </match>
    </fontconfig>
    I'd appreciate any help you could give me to improve things.
    After all, what would a monkey be without its bells?

    Comment


      #3
      Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

      Ah, yes your fonts.conf looks a lot like mine does without the Japanese bits. Basically you want to keep everything you've got as it sets font smoothing. Just add my bit at the beginning. I might update the next version to this, I just didn't want to force my smoothing policy on everyone.

      Actually, this is the file I use (looks like it has everything yours does):

      Code:
      <?xml version='1.0'?>
      <fontconfig>
       <alias>
       <family>serif</family>
       <prefer>
        <family>DejaVu Serif</family>
        <family>Times New Roman</family>
        <family>MS 明朝</family>
        <family>IPAPMincho</family>
        <family>Sazanami Mincho</family>
        <family>Kochi Mincho</family>
        <family>Bitstream Vera Serif</family>
        <family>Thorndale AMT</family>
        <family>Luxi Serif</family>
        <family>Nimbus Roman No9 L</family>
        <family>Times</family>
        <family>Frank Ruehl</family>
        <family>MgOpen Canonica</family>
        <family>AR PL SungtiL GB</family>
        <family>AR PL Mingti2L Big5</family>
        <family>FreeSerif</family>
        <family>Baekmuk Batang</family>
       </prefer>
       </alias>
       <alias>
       <family>sans-serif</family>
       <prefer>
        <family>DejaVu Sans</family>
        <family>Verdana</family>
        <family>MS ゴシック</family>
        <family>IPAPGothic</family>
        <family>Sazanami Gothic</family>
        <family>Kochi Gothic</family>
        <family>Bitstream Vera Sans</family>
        <family>Arial</family>
        <family>Albany AMT</family>
        <family>Luxi Sans</family>
        <family>Nimbus Sans L</family>
        <family>Helvetica</family>
        <family>Nachlieli</family>
        <family>MgOpen Moderna</family>
        <family>AR PL KaitiM GB</family>
        <family>AR PL KaitiM Big5</family>
        <family>FreeSans</family>
        <family>Baekmuk Dotum</family>
        <family>SimSun</family>
       </prefer>
       </alias>
       <alias>
       <family>monospace</family>
       <prefer>
        <family>DejaVu Sans Mono</family>
        <family>Courier New</family>
        <family>MS ゴシック</family>
        <family>IPAGothic</family>
        <family>Sazanami Gothic</family>
        <family>Kochi Gothic</family>
        <family>Bitstream Vera Sans Mono</family>
        <family>Andale Mono</family>
        <family>Cumberland AMT</family>
        <family>Luxi Mono</family>
        <family>Nimbus Mono L</family>
        <family>Courier</family>
        <family>Miriam Mono</family>
        <family>FreeMono</family>
        <family>AR PL KaitiM GB</family>
        <family>Baekmuk Dotum</family>
       </prefer>
       </alias>
       <match target="font" >
       <edit mode="assign" name="embeddedbitmap" >
        <bool>true</bool>
       </edit>
       </match>
       <match target="font" >
       <edit mode="assign" name="rgba" >
        <const>rgb</const>
       </edit>
       </match>
       <match target="font" >
       <edit mode="assign" name="hinting" >
        <bool>true</bool>
       </edit>
       </match>
       <match target="font" >
       <edit mode="assign" name="hintstyle" >
        <const>hintfull</const>
       </edit>
       </match>
       <match target="font" >
       <edit mode="assign" name="antialias" >
        <bool>true</bool>
       </edit>
       </match>
      </fontconfig>

      Comment


        #4
        Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

        Thank you very much for your reply. I'm still not sure why my file would not contain any mention of the Japanese fonts that must be installed as I am able to read and write kana and kanji.

        I think I'll add that extra bit yours has before mine in the /.fonts/conf file but I noticed another slight difference between the two.
        Mine has:
        Code:
        <?xml version='1.0'?>
        <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
        <fontconfig>
        Whereas yours has:
        Code:
        <?xml version='1.0'?>
        <fontconfig>
        I don't wish to sound pedantic but does this difference matter?

        Many thanks.
        After all, what would a monkey be without its bells?

        Comment


          #5
          Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

          The <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> line shouldn't make any difference. The changes, (after you've downloaded and installed the additional fonts) set the system to use the embedded bitmaps instead of rendering vectors. At small sizes this gives a consistently better look to Kanjis as because of their complexity, they don't render well, particularly with anti-aliasing on. The MS fonts have in many people's opinion a superior type face and certainly contain a better set of embedded bitmaps. Lots of people find when they just use the Ubuntu default that Kana don't match Kanjis, characters are blurred and the experience just isn't as good as it could be. If you're happy with what you started with, then by all means ignore this step. To be honest, the defaults used to be a hell of a lot worse.

          Comment


            #6
            Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

            Would just like to point out that I had to - at least in earlier distributions (Hardy--) - modify /etc/X11/xinit/xinput.d/skim to make sure it actually *pointed* to scim. The XIM_PROGRAM variable was just defined as " ".

            Code:
            XIM=SCIM
            XIM_PROGRAM=/usr/bin/scim
            XIM_ARGS=-d
            XIM_PROGRAM_SETS_ITSELF_AS_DAEMON=yes
            
            if [ -e /usr/lib/gtk-2.0/*/immodules/im-scim-bridge.so ]; then
              GTK_IM_MODULE="scim-bridge"
            elif [ -e /usr/lib/gtk-2.0/*/immodules/im-scim.so ]; then
              GTK_IM_MODULE=scim
            else
              GTK_IM_MODULE=xim
            fi
            if [ -e /usr/lib/qt3/plugins/inputmethods/im-scim-bridge.so ] || [ -e /usr/lib/qt4/plugins/inputmethods/im-scim-bridge.so ]; then
              QT_IM_MODULE="scim-bridge"
            elif [ -e /usr/lib/qt3/plugins/inputmethods/libqscim.so ]; then
              QT_IM_MODULE=scim
            else
              QT_IM_MODULE=xim
            fi
            
            DEPENDS="skim, scim-bridge-client-gtk | scim-bridge-client-qt | scim-bridge-client-qt4 | scim-gtk2-immodule | scim-qtimm"
            And the relevant xinput alternative (basically, im-switch "locale") was all_ALL for me, despite my locale being en_US.UTF-8.
            Code:
            $ sudo update-alternatives --config xinput-all_ALL
            KDE, I heart thee.

            Comment


              #7
              Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

              Zoreal,

              Good to see you here too. As I said, twas your sig in the other forum that persuaded me to come back to the dark side and currently I'm enjoying the Kookies hehehehe.

              Have to say, I'm still disappointed that that they haven't sorted out the language selector for KDE4.

              I miss your sock puppet on this forum ;-p

              Comment


                #8
                Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                Zoreal,

                Just checked out my Intrepid xinput.d/skim and found exactly the same.... no reference to SCIM from XIM_PROGRAM. Doesn't seem to make any difference though. Still works fine in all apps as far as I can see, even non QT or GTK ones. XIM=SCIM and that seems enough.

                By the way, I'm stopping by /dev/random next week.... mind if I pop in and say hi?

                Comment


                  #9
                  Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                  Originally posted by ryukent
                  I miss your sock puppet on this forum ;-p
                  Remedied! :3

                  Originally posted by ryukent
                  Just checked out my Intrepid xinput.d/skim and found exactly the same.... no reference to SCIM from XIM_PROGRAM. Doesn't seem to make any difference though. Still works fine in all apps as far as I can see, even non QT or GTK ones. XIM=SCIM and that seems enough.
                  Does it work for you in OpenOffice? I'm not at one of my KDE machines at the moment, but at least in Hardy, installing the openoffice.org-kde KDE extension package broke scim in OO.o. If memory serves at all, modifying xinput.d/skim to make sure it actually pointed to scim helped.

                  And obviously, I linked the all_ALL xinput locale (im-switch -c -z all_ALL or update-alternatives --config xinput-all_ALL) to said file.
                  KDE, I heart thee.

                  Comment


                    #10
                    Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                    When you say open office... mine works fine in the default KOffice which is based on open office. Also, you aren't by any chance using an nVidia card. I solved the video garbage problem on my system which was an error with the driver reacting to the new Kernel. I posted a howto about it:

                    http://ubuntuforums.org/showthread.php?t=993368

                    Comment


                      #11
                      Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                      While I guess it's off-topic, the video garbage bug is something I've been getting since the first betas, on several machines, using the nv, intel, and proprietary nvidia drivers. Going by the replies to other forum threads and those bug reports, the open source and proprietary ati/radeon drivers seem to be affected, too.

                      This video and this screenshot depicts it. It's still present on the 4.2 beta on the ppa listed over at kubuntu.org, though I seem to be able to minimize it by using compiz instead of kwin and by enabling some form of fade-in effect. With compiz, the window is filled with white instead of that old-memory garbage, which if anything else is an order of magnitude more aesthetically pleasing.

                      On a semi-related note, I don't think KOffice is based on OpenOffice?

                      EDIT: In a KDE4 environment, please try starting xterm and see if you can access scim from there. In Hardy--, modifying my xinput.d/<file> fixed that, but that doesn't seem to do the trick in Intrepid with the 4.2 beta from the ppa.
                      KDE, I heart thee.

                      Comment


                        #12
                        Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                        Any tips one getting Skim working under Jaunty?
                        After all, what would a monkey be without its bells?

                        Comment


                          #13
                          Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                          Originally posted by monkeybells
                          Any tips one getting Skim working under Jaunty?
                          To install:

                          Code:
                          sudo apt-get update && sudo apt-get install scim

                          To switch input method:

                          http://ubuntuforums.org/showthread.p...highlight=scim

                          Comment


                            #14
                            Re: HOWTO: Installing Japanese Input &amp; Font Setup in Kubuntu 8.10 (Intrepid) - SKIM

                            I've installed skim in Jaunty, but when I left-click the skim system tray icon the popup is blank - it contains no languages.

                            I can right-click the system tray icon, and go into the configuration where I can see that the Japanese input engine is installed:

                            [img width=400 height=319]http://i108.photobucket.com/albums/n39/bugs3000/skim.png[/img]

                            How can I get Japanese text input working?

                            Comment

                            Working...
                            X