View Single Post
Old 05-01-2015, 05:18 AM   #817
hfpop
Addict
hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.hfpop knows how many angels can dance on the head of a pin.
 
Posts: 250
Karma: 136662
Join Date: Apr 2011
Device: N/A
Change koreader to hide the CJK fonts

Quote:
Originally Posted by guerrilla View Post
I'd be interested!
You will need to edit the file
Code:
frontend/ui/font.lua
There, you will edit
Code:
function Font:_readList(target, dir)
which is the function relevant to building the list of fonts. The new code follows:
Code:
function Font:_readList(target, dir)
-- begin hfpop
    -- *.ttf files in /usr/java/lib/fonts/
    local fonts_cjk = {}
    fonts_cjk["code2000"] = true 
    fonts_cjk["HYGothicBold"] = true 
    fonts_cjk["HYGothicMedium"] = true 
    fonts_cjk["HYMyeongJoBold"] = true 
    fonts_cjk["HYMyeongJoMedium"] = true 
    fonts_cjk["MTChineseSurrogates"] = true 
    fonts_cjk["MYingHeiSBold"] = true 
    fonts_cjk["MYingHeiSMedium"] = true 
    fonts_cjk["MYingHeiTBold"] = true 
    fonts_cjk["MYingHeiTMedium"] = true 
    fonts_cjk["SongTBold"] = true 
    fonts_cjk["SongTMedium"] = true 
    fonts_cjk["STSongBold"] = true 
    fonts_cjk["STSongMedium"] = true 
    fonts_cjk["TBGothicBold_213"] = true 
    fonts_cjk["TBGothicMed_213"] = true 
    fonts_cjk["TBMinchoBold_213"] = true 
    fonts_cjk["TBMinchoMedium_213"] = true 
-- end hfpop
    -- lfs.dir non-exsitent directory will give error, weird!
    local ok, iter, dir_obj = pcall(lfs.dir, dir)
    if not ok then return end
    for f in iter, dir_obj do
        if lfs.attributes(dir.."/"..f, "mode") == "directory" and f ~= "." and f ~= ".." then
            self:_readList(target, dir.."/"..f)
        else
            local file_type = string.lower(string.match(f, ".+%.([^.]+)") or "")
            if file_type == "ttf" or file_type == "ttc"
                or file_type == "cff" or file_type == "otf" then
-- begin hfpop
            local file_name = string.match(f, "(.+)%.[^.]+")
            if fonts_cjk[file_name] == nil then
-- end hfpop
                table.insert(target, dir.."/"..f)
-- begin hfpop
            end
-- end hfpop
            end
        end
    end
end
You will need to edit YOUR version of this file according to my additions.
hfpop is offline   Reply With Quote