Ticket #11518: 0001-Implemented-BFont-Blocks-added-build-feature-for-fon.patch

File 0001-Implemented-BFont-Blocks-added-build-feature-for-fon.patch, 30.7 KB (added by digib0y, 7 years ago)

First step, new blocks in next patch.

  • build/jam/BuildFeatures

    From 4af8aa6b4f58adb85a684c939b8c9e533bc3ce08 Mon Sep 17 00:00:00 2001
    From: deep-1 <code.deepanshu@gmail.com>
    Date: Thu, 9 Mar 2017 22:54:05 +0000
    Subject: [PATCH] Implemented BFont::Blocks - added build feature for 
     fontconfig - added appserver interface for querying unicode blocks - added
     GetUnicodeBlocks function in ServerFont for doing the actual querying; looks
     up appropriate blocks for codepoint using binary search
    
    Implemented BFont::Blocks - added build feature for fontconfig - added appserver interface for querying
    unicode blocks - added  GetUnicodeBlocks function in ServerFont for doing the actual querying; looks up
    appropriate blocks for codepoint using binary search
    ---
     build/jam/BuildFeatures                    |  15 ++
     headers/os/interface/Font.h                |  12 +-
     headers/os/interface/UnicodeBlockObjects.h | 292 ++++++++++++++++++++++++++++-
     headers/private/app/ServerProtocol.h       |   3 +-
     src/kits/interface/Font.cpp                |  19 +-
     src/servers/app/Jamfile                    |  17 +-
     src/servers/app/ProfileMessageSupport.cpp  |   3 +-
     src/servers/app/ServerApp.cpp              |  33 +++-
     src/servers/app/ServerFont.cpp             | 109 ++++++++++-
     src/servers/app/ServerFont.h               |   3 +-
     10 files changed, 494 insertions(+), 12 deletions(-)
    
    diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
    index 4312be0..b2cad70 100644
    a b if [ IsPackageAvailable freetype_devel ] {  
    303303    Echo "Freetype support not available on $(TARGET_PACKAGING_ARCH)" ;
    304304}
    305305
     306# fontconfig
     307if [ IsPackageAvailable fontconfig_devel ] {
     308    ExtractBuildFeatureArchives fontconfig :
     309        file: base fontconfig
     310            runtime: lib
     311        file: devel fontconfig_devel
     312            depends: base
     313            library: $(developLibDir)/libfontconfig.so
     314            headers: $(developHeadersDir) $(developHeadersDir)/fontconfig
     315        ;
     316
     317    EnableBuildFeatures fontconfig ;
     318} else {
     319    Echo "fontconfig support not available on $(TARGET_PACKAGING_ARCH)" ;
     320}
    306321
    307322# Gutenprint
    308323if [ IsPackageAvailable gutenprint_devel ] {
  • headers/os/interface/Font.h

    diff --git a/headers/os/interface/Font.h b/headers/os/interface/Font.h
    index eb7d59c..fafb388 100644
    a b  
    11/*
    2  * Copyright 2005-2015, Haiku, Inc. All rights reserved.
     2 * Copyright 2005-2017, Haiku, Inc. All rights reserved.
    33 * Distributed under the terms of the MIT License.
    44 */
    55#ifndef _FONT_H_
    private:  
    120120};
    121121
    122122
     123struct unicode_block_range {
     124    uint32                  start;
     125    uint32                  end;
     126    const unicode_block&    block;
     127
     128    uint32 Count() const { return end + 1 - start; }
     129};
     130
     131
    123132struct edge_info {
    124133    float   left;
    125134    float   right;
    unicode_block::operator=(const unicode_block& block)  
    371380{
    372381    fData[0] = block.fData[0];
    373382    fData[1] = block.fData[1];
     383
    374384    return *this;
    375385}
    376386
  • headers/os/interface/UnicodeBlockObjects.h

    diff --git a/headers/os/interface/UnicodeBlockObjects.h b/headers/os/interface/UnicodeBlockObjects.h
    index ed5061e..0bc3963 100644
    a b  
    11/*
    2  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
     2 * Copyright 2001-2017, Haiku, Inc. All rights reserved.
    33 * Distributed under the terms of the MIT License.
    44 */
    55#ifndef _UNICODEBLOCKOBJECTS_H
     
    1010
    1111
    1212// Unicode block list with their unicode encoding range
     13//
     14// Original BeOS-compatible blocks
    1315const unicode_block B_BASIC_LATIN_BLOCK(                    /* 0000 - 007F          */  0x0000000000000000LL, 0x0000000000000001LL);
    1416const unicode_block B_LATIN1_SUPPLEMENT_BLOCK(              /* 0080 - 00FF          */  0x0000000000000000LL, 0x0000000000000002LL);
    1517const unicode_block B_LATIN_EXTENDED_A_BLOCK(               /* 0100 - 017F          */  0x0000000000000000LL, 0x0000000000000004LL);
    const unicode_block B_HALFWIDTH_AND_FULLWIDTH_FORMS_BLOCK( /* FF00 - FFEF */ 0  
    8284const unicode_block B_SPECIALS_BLOCK(                       /* FEFF and FFF0 - FFFF */  0x0000000000000020LL, 0x0000000000000000LL);
    8385const unicode_block B_TIBETAN_BLOCK(                        /* 0F00 - 0FBF          */  0x0000000000000040LL, 0x0000000000000000LL);
    8486
     87// Haiku additional Unicode blocks
     88const unicode_block B_SYRIAC_BLOCK(                         /* 0700 - 074F          */  0LL, 0LL, 1LL <<  8, 0LL);
     89const unicode_block B_ARABIC_SUPPLEMENT_BLOCK(              /* 0750 - 077F          */  0LL, 0LL, 1LL <<  9, 0LL);
     90const unicode_block B_THAANA_BLOCK(                         /* 0780 - 07BF          */  0LL, 0LL, 1LL << 10, 0LL);
     91const unicode_block B_N_KO_BLOCK(                           /* 07C0 - 07FF          */  0LL, 0LL, 1LL << 11, 0LL);
     92const unicode_block B_SINHALA_BLOCK(                        /* 0D80 - 0DFF          */  0LL, 0LL, 1LL << 12, 0LL);
     93const unicode_block B_MYANMAR_BLOCK(                        /* 1000 - 109F          */  0LL, 0LL, 1LL << 13, 0LL);
     94const unicode_block B_ETHIOPIC_BLOCK(                       /* 1200 - 137F          */  0LL, 0LL, 1LL << 14, 0LL);
     95const unicode_block B_ETHIOPIC_SUPPLEMENT_BLOCK(            /* 1380 - 139F          */  0LL, 0LL, 1LL << 15, 0LL);
     96const unicode_block B_CHEROKEE_BLOCK(                       /* 13A0 - 13FF          */  0LL, 0LL, 1LL << 16, 0LL);
     97const unicode_block B_UNIFIED_CANADIAN_ABORIGINAL_BLOCK(    /* 1400 - 167F          */  0LL, 0LL, 1LL << 17, 0LL);
     98const unicode_block B_OGHAM_BLOCK(                          /* 1680 - 169F          */  0LL, 0LL, 1LL << 18, 0LL);
     99const unicode_block B_RUNIC_BLOCK(                          /* 16A0 - 16FF          */  0LL, 0LL, 1LL << 19, 0LL);
     100const unicode_block B_TAGALOG_BLOCK(                        /* 1700 - 171F          */  0LL, 0LL, 1LL << 20, 0LL);
     101const unicode_block B_HANUNOO_BLOCK(                        /* 1720 - 173F          */  0LL, 0LL, 1LL << 21, 0LL);
     102const unicode_block B_BUHID_BLOCK(                          /* 1740 - 175F          */  0LL, 0LL, 1LL << 22, 0LL);
     103const unicode_block B_TAGBANWA_BLOCK(                       /* 1760 - 177F          */  0LL, 0LL, 1LL << 23, 0LL);
     104const unicode_block B_KHMER_BLOCK(                          /* 1780 - 17FF          */  0LL, 0LL, 1LL << 24, 0LL);
     105const unicode_block B_MONGOLIAN_BLOCK(                      /* 1800 - 18AF          */  0LL, 0LL, 1LL << 25, 0LL);
     106const unicode_block B_LIMBU_BLOCK(                          /* 1900 - 194F          */  0LL, 0LL, 1LL << 26, 0LL);
     107const unicode_block B_TAI_LE_BLOCK(                         /* 1950 - 197F          */  0LL, 0LL, 1LL << 27, 0LL);
     108const unicode_block B_NEW_TAI_LUE_BLOCK(                    /* 1980 - 19DF          */  0LL, 0LL, 1LL << 28, 0LL);
     109const unicode_block B_KHMER_SYMBOLS_BLOCK(                  /* 19E0 - 19FF          */  0LL, 0LL, 1LL << 29, 0LL);
     110const unicode_block B_BUGINESE_BLOCK(                       /* 1A00 - 1A1F          */  0LL, 0LL, 1LL << 30, 0LL);
     111const unicode_block B_BALINESE_BLOCK(                       /* 1B00 - 1B7F          */  0LL, 0LL, 1LL << 31, 0LL);
     112const unicode_block B_SUNDANESE_BLOCK(                      /* 1B80 - 1BBF          */  0LL, 0LL, 1LL << 32, 0LL);
     113const unicode_block B_LEPCHA_BLOCK(                         /* 1C00 - 1C4F          */  0LL, 0LL, 1LL << 33, 0LL);
     114const unicode_block B_OL_CHIKI_BLOCK(                       /* 1C50 - 1C7F          */  0LL, 0LL, 1LL << 34, 0LL);
     115const unicode_block B_PHONETIC_EXTENSIONS_BLOCK(            /* 1D00 - 1D7F          */  0LL, 0LL, 1LL << 35, 0LL);
     116const unicode_block B_PHONETIC_EXTENSIONS_SUPPLEMENT_BLOCK( /* 1D80 - 1DBF          */  0LL, 0LL, 1LL << 36, 0LL);
     117const unicode_block B_COMBINING_MARKS_SUPPLEMENT_BLOCK(     /* 1DC0 - 1DFF          */  0LL, 0LL, 1LL << 37, 0LL);
     118const unicode_block B_MISC_MATHEMATICAL_SYMBOLS_A_BLOCK(    /* 27C0 - 27EF          */  0LL, 0LL, 1LL << 38, 0LL);
     119const unicode_block B_SUPPLEMENTAL_ARROWS_A_BLOCK(          /* 27F0 - 27FF          */  0LL, 0LL, 1LL << 39, 0LL);
     120const unicode_block B_BRAILLE_PATTERNS_BLOCK(               /* 2800 - 28FF          */  0LL, 0LL, 1LL << 40, 0LL);
     121const unicode_block B_SUPPLEMENTAL_ARROWS_B_BLOCK(          /* 2900 - 297F          */  0LL, 0LL, 1LL << 41, 0LL);
     122const unicode_block B_MISC_MATHEMATICAL_SYMBOLS_B_BLOCK(    /* 2980 - 29FF          */  0LL, 0LL, 1LL << 42, 0LL);
     123const unicode_block B_SUPPLEMENTAL_MATH_OPERATORS_BLOCK(    /* 2A00 - 2AFF          */  0LL, 0LL, 1LL << 43, 0LL);
     124const unicode_block B_MISC_SYMBOLS_AND_ARROWS_BLOCK(        /* 2B00 - 2BFF          */  0LL, 0LL, 1LL << 44, 0LL);
     125const unicode_block B_GLAGOTIC_BLOCK(                       /* 2C00 - 2C5F          */  0LL, 0LL, 1LL << 45, 0LL);
     126const unicode_block B_LATIN_EXTENDED_C_BLOCK(               /* 2C60 - 2C7F          */  0LL, 0LL, 1LL << 46, 0LL);
     127const unicode_block B_COPTIC_BLOCK(                         /* 2C80 - 2CFF          */  0LL, 0LL, 1LL << 47, 0LL);
     128const unicode_block B_GEORGIAN_SUPPLEMENT_BLOCK(            /* 2D00 - 2D2F          */  0LL, 0LL, 1LL << 48, 0LL);
     129const unicode_block B_TIFINAGH_BLOCK(                       /* 2D30 - 2D7F          */  0LL, 0LL, 1LL << 49, 0LL);
     130const unicode_block B_ETHIOPIC_EXTENDED_BLOCK(              /* 2D80 - 2DDF          */  0LL, 0LL, 1LL << 50, 0LL);
     131const unicode_block B_CYRILLIC_EXTENDED_A_BLOCK(            /* 2DE0 - 2DFF          */  0LL, 0LL, 1LL << 51, 0LL);
     132const unicode_block B_SUPPLEMENTAL_PUNCTUATION_BLOCK(       /* 2E00 - 2E7F          */  0LL, 0LL, 1LL << 52, 0LL);
     133const unicode_block B_CJK_RADICALS_SUPPLEMENT_BLOCK(        /* 2E80 - 2EFF          */  0LL, 0LL, 1LL << 53, 0LL);
     134const unicode_block B_KANGXI_RADICALS_BLOCK(                /* 2F00 - 2FDF          */  0LL, 0LL, 1LL << 54, 0LL);
     135const unicode_block B_IDEOGRAPHIC_DESCRIPTION_BLOCK(        /* 2FF0 - 2FFF          */  0LL, 0LL, 1LL << 55, 0LL);
     136const unicode_block B_BOPOMOFO_EXTENDED_BLOCK(              /* 31A0 - 31BF          */  0LL, 0LL, 1LL << 56, 0LL);
     137const unicode_block B_CJK_STROKES_BLOCK(                    /* 31C0 - 31EF          */  0LL, 0LL, 1LL << 57, 0LL);
     138const unicode_block B_KATAKANA_PHONETIC_EXTENSIONS_BLOCK(   /* 31F0 - 31FF          */  0LL, 0LL, 1LL << 58, 0LL);
     139const unicode_block B_CJK_UNIFIED_IDEOGRAPHS_EXT_A_BLOCK(   /* 3400 - 4DBF          */  0LL, 0LL, 1LL << 59, 0LL);
     140const unicode_block B_YIJING_HEXAGRAM_SYMBOLS_BLOCK(        /* 4DC0 - 4DFF          */  0LL, 0LL, 1LL << 60, 0LL);
     141const unicode_block B_YI_SYLLABLES_BLOCK(                   /* A000 - A48F          */  0LL, 0LL, 1LL << 61, 0LL);
     142const unicode_block B_YI_RADICALS_BLOCK(                    /* A490 - A4CF          */  0LL, 0LL, 1LL << 62, 0LL);
     143const unicode_block B_VAI_BLOCK(                            /* A500 - A63F          */  0LL, 0LL, 1LL << 63, 0LL);
     144const unicode_block B_CYRILLIC_EXTENDED_B_BLOCK(            /* A640 - A69F          */  0LL, 0LL,       0LL, 0LL);
     145const unicode_block B_MODIFIER_TONE_LETTERS_BLOCK(          /* A700 - A71F          */  0LL, 1LL <<  1, 0LL, 0LL);
     146const unicode_block B_LATIN_EXTENDED_D_BLOCK(               /* A720 - A7FF          */  0LL, 1LL <<  2, 0LL, 0LL);
     147const unicode_block B_SYLOTI_NAGRI_BLOCK(                   /* A800 - A82F          */  0LL, 1LL <<  3, 0LL, 0LL);
     148const unicode_block B_PHAGS_PA_BLOCK(                       /* A840 - A87F          */  0LL, 1LL <<  4, 0LL, 0LL);
     149const unicode_block B_SAURASHTRA_BLOCK(                     /* A880 - A8DF          */  0LL, 1LL <<  5, 0LL, 0LL);
     150const unicode_block B_KAYAH_LI_BLOCK(                       /* A900 - A92F          */  0LL, 1LL <<  6, 0LL, 0LL);
     151const unicode_block B_REJANG_BLOCK(                         /* A930 - A95F          */  0LL, 1LL <<  7, 0LL, 0LL);
     152const unicode_block B_CHAM_BLOCK(                           /* AA00 - AA5F          */  0LL, 1LL <<  8, 0LL, 0LL);
     153const unicode_block B_HANGUL_SYLLABLES_BLOCK(               /* AC00 - D7AF          */  0LL, 1LL <<  9, 0LL, 0LL);
     154const unicode_block B_VARIATION_SELECTORS_BLOCK(            /* FE00 - FE0F          */  0LL, 1LL << 10, 0LL, 0LL);
     155const unicode_block B_VERTICAL_FORMS_BLOCK(                 /* FE10 - FE1F          */  0LL, 1LL << 11, 0LL, 0LL);
     156const unicode_block B_LINEAR_B_SYLLABARY_BLOCK(             /* 10000 - 1007F        */  0LL, 1LL << 12, 0LL, 0LL);
     157const unicode_block B_LINEAR_B_IDEOGRAMS_BLOCK(             /* 10080 - 100FF        */  0LL, 1LL << 13, 0LL, 0LL);
     158const unicode_block B_AEGEAN_NUMBERS_BLOCK(                 /* 10100 - 1013F        */  0LL, 1LL << 14, 0LL, 0LL);
     159const unicode_block B_ANCIENT_GREEK_NUMBERS_BLOCK(          /* 10140 - 1018F        */  0LL, 1LL << 15, 0LL, 0LL);
     160const unicode_block B_ANCIENT_SYMBOLS_BLOCK(                /* 10190 - 101CF        */  0LL, 1LL << 16, 0LL, 0LL);
     161const unicode_block B_PHAISTOS_DISC_BLOCK(                  /* 101D0 - 101FF        */  0LL, 1LL << 17, 0LL, 0LL);
     162const unicode_block B_LYCIAN_BLOCK(                         /* 10280 - 1029F        */  0LL, 1LL << 18, 0LL, 0LL);
     163const unicode_block B_CARIAN_BLOCK(                         /* 102A0 - 102DF        */  0LL, 1LL << 19, 0LL, 0LL);
     164const unicode_block B_OLD_ITALIC_BLOCK(                     /* 10300 - 1032F        */  0LL, 1LL << 20, 0LL, 0LL);
     165const unicode_block B_GOTHIC_BLOCK(                         /* 10330 - 1034F        */  0LL, 1LL << 21, 0LL, 0LL);
     166const unicode_block B_UGARITIC_BLOCK(                       /* 10380 - 1039F        */  0LL, 1LL << 22, 0LL, 0LL);
     167const unicode_block B_OLD_PERSIAN_BLOCK(                    /* 103A0 - 103DF        */  0LL, 1LL << 23, 0LL, 0LL);
     168const unicode_block B_DESERET_BLOCK(                        /* 10400 - 1044F        */  0LL, 1LL << 24, 0LL, 0LL);
     169const unicode_block B_SHAVIAN_BLOCK(                        /* 10450 - 1047F        */  0LL, 1LL << 25, 0LL, 0LL);
     170const unicode_block B_OSMANYA_BLOCK(                        /* 10480 - 104AF        */  0LL, 1LL << 26, 0LL, 0LL);
     171const unicode_block B_CYPRIOT_SYLLABARY_BLOCK(              /* 10800 - 1083F        */  0LL, 1LL << 27, 0LL, 0LL);
     172const unicode_block B_PHOENICIAN_BLOCK(                     /* 10900 - 1091F        */  0LL, 1LL << 28, 0LL, 0LL);
     173const unicode_block B_LYDIAN_BLOCK(                         /* 10920 - 1093F        */  0LL, 1LL << 29, 0LL, 0LL);
     174const unicode_block B_KHAROSHTHI_BLOCK(                     /* 10A00 - 10A5F        */  0LL, 1LL << 30, 0LL, 0LL);
     175const unicode_block B_CUNEIFORM_BLOCK(                      /* 12000 - 123FF        */  0LL, 1LL << 31, 0LL, 0LL);
     176const unicode_block B_CUNEIFORM_NUMBERS_PUNCTUATION_BLOCK(  /* 12400 - 1247F        */  0LL, 1LL << 32, 0LL, 0LL);
     177const unicode_block B_BYZANTINE_MUSICAL_SYMBOLS_BLOCK(      /* 1D000 - 1D0FF        */  0LL, 1LL << 33, 0LL, 0LL);
     178const unicode_block B_MUSICAL_SYMBOLS_BLOCK(                /* 1D100 - 1D1FF        */  0LL, 1LL << 34, 0LL, 0LL);
     179const unicode_block B_ANCIENT_GREEK_MUSICAL_SYMBOLS_BLOCK(  /* 1D200 - 1D24F        */  0LL, 1LL << 35, 0LL, 0LL);
     180const unicode_block B_TAI_XUAN_JING_SYMBOLS_BLOCK(          /* 1D300 - 1D35F        */  0LL, 1LL << 36, 0LL, 0LL);
     181const unicode_block B_COUNTING_ROD_NUMERALS_BLOCK(          /* 1D360 - 1D37F        */  0LL, 1LL << 37, 0LL, 0LL);
     182const unicode_block B_MATHEMATICAL_ALPHANUM_SYMBOLS_BLOCK(  /* 1D400 - 1D7FF        */  0LL, 1LL << 38, 0LL, 0LL);
     183const unicode_block B_MAHJONG_TILES_BLOCK(                  /* 1F000 - 1F02F        */  0LL, 1LL << 39, 0LL, 0LL);
     184const unicode_block B_DOMINO_TILES_BLOCK(                   /* 1F030 - 1F09F        */  0LL, 1LL << 40, 0LL, 0LL);
     185const unicode_block B_CJK_UNIFIED_IDEOGRAPHS_EXT_B_BLOCK(   /* 20000 - 2A6DF        */  0LL, 1LL << 41, 0LL, 0LL);
     186const unicode_block B_CJK_IDEOGRAPHS_SUPPLEMENT_BLOCK(      /* 2F800 - 2FA1F        */  0LL, 1LL << 42, 0LL, 0LL);
     187const unicode_block B_TAGS_BLOCK(                           /* E0000 - E007F        */  0LL, 1LL << 43, 0LL, 0LL);
     188const unicode_block B_VARIATION_SELECTORS_SUPPLEMENT_BLOCK( /* E0100 - E01EF        */  0LL, 1LL << 44, 0LL, 0LL);
     189const unicode_block B_SUPPLEMENTARY_PRIVATE_USE_A_BLOCK(    /* F0000 - FFFFF        */  0LL, 1LL << 45, 0LL, 0LL);
     190const unicode_block B_SUPPLEMENTARY_PRIVATE_USE_B_BLOCK(    /* 100000 - 10FFFF      */  0LL, 1LL << 46, 0LL, 0LL);
     191const unicode_block B_CYRILLIC_SUPPLEMENT_BLOCK(            /* 0500 - 052F          */  0LL, 1LL << 47, 0LL, 0LL);
     192const unicode_block B_HIGH_PRIVATE_USE_SURROGATES_BLOCK(    /* DB80 - DBFF          */  0LL, 1LL << 48, 0LL, 0LL);
     193
     194
     195const unicode_block_range kUnicodeBlockMap[] = {
     196    {0x0000, 0x007f, B_BASIC_LATIN_BLOCK },
     197    {0x0080, 0x00ff, B_LATIN1_SUPPLEMENT_BLOCK },
     198    {0x0100, 0x017f, B_LATIN_EXTENDED_A_BLOCK },
     199    {0x0180, 0x024f, B_LATIN_EXTENDED_B_BLOCK },
     200    {0x0250, 0x02af, B_IPA_EXTENSIONS_BLOCK },
     201    {0x02b0, 0x02ff, B_SPACING_MODIFIER_LETTERS_BLOCK },
     202    {0x0300, 0x036f, B_COMBINING_DIACRITICAL_MARKS_BLOCK },
     203    {0x0370, 0x03cf, B_BASIC_GREEK_BLOCK },
     204    {0x03d0, 0x03ff, B_GREEK_SYMBOLS_AND_COPTIC_BLOCK },
     205    {0x0400, 0x04ff, B_CYRILLIC_BLOCK },
     206    {0x0500, 0x052f, B_CYRILLIC_SUPPLEMENT_BLOCK },
     207    {0x0530, 0x058f, B_ARMENIAN_BLOCK },
     208    {0x0590, 0x05cf, B_BASIC_HEBREW_BLOCK },
     209    {0x05d0, 0x05ff, B_HEBREW_EXTENDED_BLOCK },
     210    {0x0600, 0x0670, B_BASIC_ARABIC_BLOCK },
     211    {0x0671, 0x06ff, B_ARABIC_EXTENDED_BLOCK },
     212    {0x0700, 0x074f, B_SYRIAC_BLOCK },
     213    {0x0750, 0x077f, B_ARABIC_SUPPLEMENT_BLOCK },
     214    {0x0780, 0x07bf, B_THAANA_BLOCK },
     215    {0x07c0, 0x07ff, B_N_KO_BLOCK },
     216    {0x0900, 0x097f, B_DEVANAGARI_BLOCK },
     217    {0x0980, 0x09ff, B_BENGALI_BLOCK },
     218    {0x0a00, 0x0a7f, B_GURMUKHI_BLOCK },
     219    {0x0a80, 0x0aff, B_GUJARATI_BLOCK },
     220    {0x0b00, 0x0b7f, B_ORIYA_BLOCK },
     221    {0x0b80, 0x0bff, B_TAMIL_BLOCK },
     222    {0x0c00, 0x0c7f, B_TELUGU_BLOCK },
     223    {0x0c80, 0x0cff, B_KANNADA_BLOCK},
     224    {0x0d00, 0x0d7f, B_MALAYALAM_BLOCK},
     225    {0x0d80, 0x0dff, B_SINHALA_BLOCK},
     226    {0x0e00, 0x0e7f, B_THAI_BLOCK},
     227    {0x0e80, 0x0eff, B_LAO_BLOCK},
     228    {0x0f00, 0x0fff, B_TIBETAN_BLOCK},
     229    {0x1000, 0x109f, B_MYANMAR_BLOCK},
     230    {0x10a0, 0x10ff, B_BASIC_GEORGIAN_BLOCK},
     231    {0x1100, 0x11ff, B_HANGUL_JAMO_BLOCK},
     232    {0x1200, 0x137f, B_ETHIOPIC_BLOCK},
     233    {0x1380, 0x139f, B_ETHIOPIC_SUPPLEMENT_BLOCK},
     234    {0x13a0, 0x13ff, B_CHEROKEE_BLOCK},
     235    {0x1400, 0x167f, B_UNIFIED_CANADIAN_ABORIGINAL_BLOCK},
     236    {0x1680, 0x169f, B_OGHAM_BLOCK},
     237    {0x16a0, 0x16ff, B_RUNIC_BLOCK},
     238    {0x1700, 0x171f, B_TAGALOG_BLOCK},
     239    {0x1720, 0x173f, B_HANUNOO_BLOCK},
     240    {0x1740, 0x175f, B_BUHID_BLOCK},
     241    {0x1760, 0x177f, B_TAGBANWA_BLOCK},
     242    {0x1780, 0x17ff, B_KHMER_BLOCK},
     243    {0x1800, 0x18af, B_MONGOLIAN_BLOCK},
     244    {0x1900, 0x194f, B_LIMBU_BLOCK},
     245    {0x1950, 0x197f, B_TAI_LE_BLOCK},
     246    {0x1980, 0x19df, B_NEW_TAI_LUE_BLOCK},
     247    {0x19e0, 0x19ff, B_KHMER_SYMBOLS_BLOCK},
     248    {0x1a00, 0x1a1f, B_BUGINESE_BLOCK},
     249    {0x1b00, 0x1b7f, B_BALINESE_BLOCK},
     250    {0x1b80, 0x1bbf, B_SUNDANESE_BLOCK},
     251    {0x1c00, 0x1c4f, B_LEPCHA_BLOCK},
     252    {0x1c50, 0x1c7f, B_OL_CHIKI_BLOCK},
     253    {0x1d00, 0x1d7f, B_PHONETIC_EXTENSIONS_BLOCK},
     254    {0x1d80, 0x1dbf, B_PHONETIC_EXTENSIONS_SUPPLEMENT_BLOCK},
     255    {0x1dc0, 0x1dff, B_COMBINING_MARKS_SUPPLEMENT_BLOCK},
     256    {0x1e00, 0x1eff, B_LATIN_EXTENDED_ADDITIONAL_BLOCK},
     257    {0x1f00, 0x1fff, B_GREEK_EXTENDED_BLOCK},
     258    {0x2000, 0x206f, B_GENERAL_PUNCTUATION_BLOCK},
     259    {0x2070, 0x209f, B_SUPERSCRIPTS_AND_SUBSCRIPTS_BLOCK},
     260    {0x20a0, 0x20cf, B_CURRENCY_SYMBOLS_BLOCK},
     261    {0x20d0, 0x20ff, B_COMBINING_MARKS_FOR_SYMBOLS_BLOCK},
     262    {0x2100, 0x214f, B_LETTERLIKE_SYMBOLS_BLOCK},
     263    {0x2150, 0x218f, B_NUMBER_FORMS_BLOCK},
     264    {0x2190, 0x21ff, B_ARROWS_BLOCK},
     265    {0x2200, 0x22ff, B_MATHEMATICAL_OPERATORS_BLOCK},
     266    {0x2300, 0x23ff, B_MISCELLANEOUS_TECHNICAL_BLOCK},
     267    {0x2400, 0x243f, B_CONTROL_PICTURES_BLOCK},
     268    {0x2440, 0x245f, B_OPTICAL_CHARACTER_RECOGNITION_BLOCK},
     269    {0x2460, 0x24ff, B_ENCLOSED_ALPHANUMERICS_BLOCK},
     270    {0x2500, 0x257f, B_BOX_DRAWING_BLOCK},
     271    {0x2580, 0x259f, B_BLOCK_ELEMENTS_BLOCK},
     272    {0x25a0, 0x25ff, B_GEOMETRIC_SHAPES_BLOCK},
     273    {0x2600, 0x26ff, B_MISCELLANEOUS_SYMBOLS_BLOCK},
     274    {0x2700, 0x27bf, B_DINGBATS_BLOCK},
     275    {0x27c0, 0x27ef, B_MISC_MATHEMATICAL_SYMBOLS_A_BLOCK},
     276    {0x27f0, 0x27ff, B_SUPPLEMENTAL_ARROWS_A_BLOCK},
     277    {0x2800, 0x28ff, B_BRAILLE_PATTERNS_BLOCK},
     278    {0x2900, 0x297f, B_SUPPLEMENTAL_ARROWS_B_BLOCK},
     279    {0x2980, 0x29ff, B_MISC_MATHEMATICAL_SYMBOLS_B_BLOCK},
     280    {0x2a00, 0x2aff, B_SUPPLEMENTAL_MATH_OPERATORS_BLOCK},
     281    {0x2b00, 0x2bff, B_MISC_SYMBOLS_AND_ARROWS_BLOCK},
     282    {0x2c00, 0x2c5f, B_GLAGOTIC_BLOCK},
     283    {0x2c60, 0x2c7f, B_LATIN_EXTENDED_C_BLOCK},
     284    {0x2c80, 0x2cff, B_COPTIC_BLOCK},
     285    {0x2d00, 0x2d2f, B_GEORGIAN_SUPPLEMENT_BLOCK},
     286    {0x2d30, 0x2d7f, B_TIFINAGH_BLOCK},
     287    {0x2d80, 0x2ddf, B_ETHIOPIC_EXTENDED_BLOCK},
     288    {0x2de0, 0x2dff, B_CYRILLIC_EXTENDED_A_BLOCK},
     289    {0x2e00, 0x2e7f, B_SUPPLEMENTAL_PUNCTUATION_BLOCK},
     290    {0x2e80, 0x2eff, B_CJK_RADICALS_SUPPLEMENT_BLOCK},
     291    {0x2f00, 0x2fdf, B_KANGXI_RADICALS_BLOCK},
     292    {0x2ff0, 0x2fff, B_IDEOGRAPHIC_DESCRIPTION_BLOCK},
     293    {0x3000, 0x303f, B_CJK_SYMBOLS_AND_PUNCTUATION_BLOCK},
     294    {0x3040, 0x309f, B_HIRAGANA_BLOCK},
     295    {0x30a0, 0x30ff, B_KATAKANA_BLOCK},
     296    {0x3100, 0x312f, B_BOPOMOFO_BLOCK},
     297    {0x3130, 0x318f, B_HANGUL_COMPATIBILITY_JAMO_BLOCK},
     298    {0x3190, 0x319f, B_CJK_MISCELLANEOUS_BLOCK},
     299    {0x31a0, 0x31bf, B_BOPOMOFO_EXTENDED_BLOCK},
     300    {0x31c0, 0x31ef, B_CJK_STROKES_BLOCK},
     301    {0x31f0, 0x31ff, B_KATAKANA_PHONETIC_EXTENSIONS_BLOCK},
     302    {0x3200, 0x32ff, B_ENCLOSED_CJK_LETTERS_AND_MONTHS_BLOCK},
     303    {0x3300, 0x33ff, B_CJK_COMPATIBILITY_BLOCK},
     304    {0x3400, 0x4dbf, B_CJK_UNIFIED_IDEOGRAPHS_EXT_A_BLOCK},
     305    {0x4dc0, 0x4dff, B_YIJING_HEXAGRAM_SYMBOLS_BLOCK},
     306    {0x4e00, 0x9fff, B_CJK_UNIFIED_IDEOGRAPHS_BLOCK},
     307    {0xa000, 0xa48f, B_YI_SYLLABLES_BLOCK},
     308    {0xa490, 0xa4cf, B_YI_RADICALS_BLOCK},
     309    {0xa500, 0xa63f, B_VAI_BLOCK},
     310    {0xa640, 0xa69f, B_CYRILLIC_EXTENDED_B_BLOCK},
     311    {0xa700, 0xa71f, B_MODIFIER_TONE_LETTERS_BLOCK},
     312    {0xa720, 0xa7ff, B_LATIN_EXTENDED_D_BLOCK},
     313    {0xa800, 0xa82f, B_SYLOTI_NAGRI_BLOCK},
     314    {0xa840, 0xa87f, B_PHAGS_PA_BLOCK},
     315    {0xa880, 0xa8df, B_SAURASHTRA_BLOCK},
     316    {0xa900, 0xa92f, B_KAYAH_LI_BLOCK},
     317    {0xa930, 0xa95f, B_REJANG_BLOCK},
     318    {0xaa00, 0xaa5f, B_CHAM_BLOCK},
     319    {0xac00, 0xd7af, B_HANGUL_SYLLABLES_BLOCK},
     320    {0xd800, 0xdb7f, B_HIGH_SURROGATES_BLOCK},
     321    {0xdb80, 0xdbff, B_HIGH_PRIVATE_USE_SURROGATES_BLOCK},
     322    {0xdc00, 0xdfff, B_LOW_SURROGATES_BLOCK},
     323    {0xe000, 0xf8ff, B_PRIVATE_USE_AREA_BLOCK},
     324    {0xf900, 0xfaff, B_CJK_COMPATIBILITY_IDEOGRAPHS_BLOCK},
     325    {0xfb00, 0xfb4f, B_ALPHABETIC_PRESENTATION_FORMS_BLOCK},
     326    {0xfb50, 0xfdff, B_ARABIC_PRESENTATION_FORMS_A_BLOCK},
     327    {0xfe00, 0xfe0f, B_VARIATION_SELECTORS_BLOCK},
     328    {0xfe10, 0xfe1f, B_VERTICAL_FORMS_BLOCK},
     329    {0xfe20, 0xfe2f, B_COMBINING_HALF_MARKS_BLOCK},
     330    {0xfe30, 0xfe4f, B_CJK_COMPATIBILITY_FORMS_BLOCK},
     331    {0xfe50, 0xfe6f, B_SMALL_FORM_VARIANTS_BLOCK},
     332    {0xfe70, 0xfeff, B_ARABIC_PRESENTATION_FORMS_B_BLOCK},
     333    {0xff00, 0xffef, B_HALFWIDTH_AND_FULLWIDTH_FORMS_BLOCK},
     334    {0xfff0, 0xffff, B_SPECIALS_BLOCK},
     335    {0x010000, 0x01007f, B_LINEAR_B_SYLLABARY_BLOCK},
     336    {0x010080, 0x0100ff, B_LINEAR_B_IDEOGRAMS_BLOCK},
     337    {0x010100, 0x01013f, B_AEGEAN_NUMBERS_BLOCK},
     338    {0x010140, 0x01018f, B_ANCIENT_GREEK_NUMBERS_BLOCK},
     339    {0x010190, 0x0101cf, B_ANCIENT_SYMBOLS_BLOCK},
     340    {0x0101d0, 0x0101ff, B_PHAISTOS_DISC_BLOCK},
     341    {0x010280, 0x01029f, B_LYCIAN_BLOCK},
     342    {0x0102a0, 0x0102df, B_CARIAN_BLOCK},
     343    {0x010300, 0x01032f, B_OLD_ITALIC_BLOCK},
     344    {0x010330, 0x01034f, B_GOTHIC_BLOCK},
     345    {0x010380, 0x01039f, B_UGARITIC_BLOCK},
     346    {0x0103a0, 0x0103df, B_OLD_PERSIAN_BLOCK},
     347    {0x010400, 0x01044f, B_DESERET_BLOCK},
     348    {0x010450, 0x01047f, B_SHAVIAN_BLOCK},
     349    {0x010480, 0x0104af, B_OSMANYA_BLOCK},
     350    {0x010800, 0x01083f, B_CYPRIOT_SYLLABARY_BLOCK},
     351    {0x010900, 0x01091f, B_PHOENICIAN_BLOCK},
     352    {0x010920, 0x01093f, B_LYDIAN_BLOCK},
     353    {0x010a00, 0x010a5f, B_KHAROSHTHI_BLOCK},
     354    {0x012000, 0x0123ff, B_CUNEIFORM_BLOCK},
     355    {0x012400, 0x01247f, B_CUNEIFORM_NUMBERS_PUNCTUATION_BLOCK},
     356    {0x01d000, 0x01d0ff, B_BYZANTINE_MUSICAL_SYMBOLS_BLOCK},
     357    {0x01d100, 0x01d1ff, B_MUSICAL_SYMBOLS_BLOCK},
     358    {0x01d200, 0x01d24f, B_ANCIENT_GREEK_MUSICAL_SYMBOLS_BLOCK},
     359    {0x01d300, 0x01d35f, B_TAI_XUAN_JING_SYMBOLS_BLOCK},
     360    {0x01d360, 0x01d37f, B_COUNTING_ROD_NUMERALS_BLOCK},
     361    {0x01d400, 0x01d7ff, B_MATHEMATICAL_ALPHANUM_SYMBOLS_BLOCK},
     362    {0x01f000, 0x01f02f, B_MAHJONG_TILES_BLOCK},
     363    {0x01f030, 0x01f09f, B_DOMINO_TILES_BLOCK},
     364    {0x020000, 0x02a6df, B_CJK_UNIFIED_IDEOGRAPHS_EXT_B_BLOCK},
     365    {0x02f800, 0x02fa1f, B_CJK_IDEOGRAPHS_SUPPLEMENT_BLOCK},
     366    {0x0e0000, 0x0e007f, B_TAGS_BLOCK},
     367    {0x0e0100, 0x0e01ef, B_VARIATION_SELECTORS_SUPPLEMENT_BLOCK},
     368    {0x0f0000, 0x0fffff, B_SUPPLEMENTARY_PRIVATE_USE_A_BLOCK},
     369    {0x100000, 0x10ffff, B_SUPPLEMENTARY_PRIVATE_USE_B_BLOCK},
     370};
     371
     372const uint32 kNumUnicodeBlockRanges
     373    = sizeof(kUnicodeBlockMap) / sizeof(kUnicodeBlockMap[0]);
     374
    85375#endif  // _UNICODEBLOCKOBJECTS_H
  • headers/private/app/ServerProtocol.h

    diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h
    index 73b0a7c..984870a 100644
    a b  
    11/*
    2  * Copyright 2001-2015, Haiku.
     2 * Copyright 2001-2017, Haiku.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    enum {  
    143143    AS_GET_HAS_GLYPHS,
    144144    AS_GET_GLYPH_SHAPES,
    145145    AS_GET_TRUNCATED_STRINGS,
     146    AS_GET_UNICODE_BLOCKS,
    146147
    147148    // Screen methods
    148149    AS_VALID_SCREEN_ID,
  • src/kits/interface/Font.cpp

    diff --git a/src/kits/interface/Font.cpp b/src/kits/interface/Font.cpp
    index 804307f..8d01d54 100644
    a b  
    11/*
    2  * Copyright 2001-2015, Haiku, Inc.
     2 * Copyright 2001-2017, Haiku, Inc.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    BFont::BoundingBox() const  
    839839unicode_block
    840840BFont::Blocks() const
    841841{
    842     // TODO: Add Block support
    843     return unicode_block(~0LL, ~0LL);
     842    BPrivate::AppServerLink link;
     843    link.StartMessage(AS_GET_UNICODE_BLOCKS);
     844    link.Attach<uint16>(fFamilyID);
     845    link.Attach<uint16>(fStyleID);
     846
     847    int32 status;
     848    if (link.FlushWithReply(status) != B_OK
     849        || status != B_OK) {
     850        return unicode_block(~0LL, ~0LL, ~0LL, ~0LL);
     851    }
     852
     853    unicode_block blocksForFont;
     854    link.Read<unicode_block>(&blocksForFont);
     855
     856    return blocksForFont;
    844857}
    845858
    846859
  • src/servers/app/Jamfile

    diff --git a/src/servers/app/Jamfile b/src/servers/app/Jamfile
    index 8f567ab..04c4afa 100644
    a b local font_src =  
    3232    ;
    3333
    3434UseBuildFeatureHeaders freetype ;
    35 Includes [ FGristFiles AppServer.cpp BitmapManager.cpp Canvas.cpp
     35if [ FIsBuildFeatureEnabled fontconfig ] {
     36    SubDirC++Flags -DFONTCONFIG_ENABLED ;
     37    UseBuildFeatureHeaders fontconfig ;
     38    Includes [ FGristFiles AppServer.cpp BitmapManager.cpp Canvas.cpp
     39    ClientMemoryAllocator.cpp Desktop.cpp DesktopSettings.cpp
     40    DrawState.cpp DrawingEngine.cpp Layer.cpp PictureBoundingBoxPlayer.cpp
     41    ServerApp.cpp ServerBitmap.cpp ServerCursor.cpp ServerFont.cpp
     42    ServerPicture.cpp ServerWindow.cpp View.cpp Window.cpp WorkspacesView.cpp
     43    $(decorator_src) $(font_src) ]
     44    : [ BuildFeatureAttribute freetype : headers ]
     45      [ BuildFeatureAttribute fontconfig : headers ] ;
     46} else {
     47    Includes [ FGristFiles AppServer.cpp BitmapManager.cpp Canvas.cpp
    3648    ClientMemoryAllocator.cpp Desktop.cpp DesktopSettings.cpp
    3749    DrawState.cpp DrawingEngine.cpp Layer.cpp PictureBoundingBoxPlayer.cpp
    3850    ServerApp.cpp ServerBitmap.cpp ServerCursor.cpp ServerFont.cpp
    3951    ServerPicture.cpp ServerWindow.cpp View.cpp Window.cpp WorkspacesView.cpp
    4052    $(decorator_src) $(font_src) ]
    4153    : [ BuildFeatureAttribute freetype : headers ] ;
    42 
     54}
    4355
    4456local BROKEN_64 = ;
    4557if $(TARGET_ARCH) != x86_64 {
    Server app_server :  
    103115    libaslocal.a $(BROKEN_64)libasremote.a $(BROKEN_64)libashtml5.a
    104116    libasdrawing.a libpainter.a libagg.a
    105117    [ BuildFeatureAttribute freetype : library ]
     118    [ BuildFeatureAttribute fontconfig : library ]
    106119    libstackandtile.a liblinprog.a libtextencoding.so shared
    107120    [ TargetLibstdc++ ]
    108121
  • src/servers/app/ProfileMessageSupport.cpp

    diff --git a/src/servers/app/ProfileMessageSupport.cpp b/src/servers/app/ProfileMessageSupport.cpp
    index f48f3bd..f30bd89 100644
    a b  
    11/*
    2  * Copyright 2007-2009, Haiku Inc. All rights reserved.
     2 * Copyright 2007-2017, Haiku Inc. All rights reserved.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    string_for_message_code(uint32 code, BString& string)  
    125125        CODE(AS_GET_HAS_GLYPHS);
    126126        CODE(AS_GET_GLYPH_SHAPES);
    127127        CODE(AS_GET_TRUNCATED_STRINGS);
     128        CODE(AS_GET_UNICODE_BLOCKS);
    128129
    129130        // Screen methods
    130131        CODE(AS_VALID_SCREEN_ID);
  • src/servers/app/ServerApp.cpp

    diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp
    index d3258e5..832d2b4 100644
    a b  
    11/*
    2  * Copyright 2001-2016, Haiku.
     2 * Copyright 2001-2017, Haiku.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)  
    20282028            break;
    20292029        }
    20302030
     2031        case AS_GET_UNICODE_BLOCKS:
     2032        {
     2033            FTRACE(("ServerApp %s: AS_GET_UNICODE_BLOCKS\n", Signature()));
     2034
     2035            // Attached Data:
     2036            // 1) uint16 family ID
     2037            // 2) uint16 style ID
     2038
     2039            // Returns:
     2040            // 1) unicode_block - bitfield of Unicode blocks in font
     2041
     2042            uint16 familyID, styleID;
     2043            float size;
     2044            link.Read<uint16>(&familyID);
     2045            link.Read<uint16>(&styleID);
     2046            link.Read<float>(&size);
     2047
     2048            ServerFont font;
     2049            status_t status = font.SetFamilyAndStyle(familyID, styleID);
     2050            if (status == B_OK) {
     2051                unicode_block blocksForFont;
     2052                font.GetUnicodeBlocks(blocksForFont);
     2053
     2054                fLink.Attach(&blocksForFont, sizeof(blocksForFont));
     2055            } else
     2056                fLink.StartMessage(status);
     2057
     2058            fLink.Flush();
     2059            break;
     2060        }
     2061
    20312062        case AS_GET_GLYPH_SHAPES:
    20322063        {
    20332064            FTRACE(("ServerApp %s: AS_GET_GLYPH_SHAPES\n", Signature()));
  • src/servers/app/ServerFont.cpp

    diff --git a/src/servers/app/ServerFont.cpp b/src/servers/app/ServerFont.cpp
    index d84068c..f0e9c7b 100644
    a b  
    11/*
    2  * Copyright 2001-2016, Haiku.
     2 * Copyright 2001-2017, Haiku.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
     
    2222#include FT_GLYPH_H
    2323#include FT_OUTLINE_H
    2424
     25#ifdef FONTCONFIG_ENABLED
     26
     27#include <fontconfig.h>
     28#include <fcfreetype.h>
     29
     30#endif // FONTCONFIG_ENABLED
     31
    2532#include <Shape.h>
    2633#include <String.h>
     34#include <UnicodeBlockObjects.h>
    2735#include <UTF8.h>
    2836
    2937#include <agg_bounding_rect.h>
    ServerFont::GetGlyphShapes(const char charArray[], int32 numChars,  
    437445}
    438446
    439447
     448#ifdef FONTCONFIG_ENABLED
     449
     450void
     451FindBlockForCodepoint(uint32 codePoint, unicode_block &blocksForMap)
     452{
     453    uint32 min = 0;
     454    uint32 max = kNumUnicodeBlockRanges;
     455
     456    while (max >= min) {
     457        uint32 guess = (max + min) / 2;
     458        uint32 start = kUnicodeBlockMap[guess].start;
     459        uint32 end = kUnicodeBlockMap[guess].end;
     460
     461        if (start <= codePoint && end >= codePoint) {
     462            blocksForMap = blocksForMap | kUnicodeBlockMap[guess].block;
     463            max = min;
     464        }
     465
     466        if (end < codePoint) {
     467            min = guess + 1;
     468        } else {
     469            max = guess - 1;
     470        }
     471    }
     472}
     473
     474/*
     475    parses charmap from fontconfig.  See fontconfig docs for FcCharSetFirstPage
     476    and FcCharSetNextPage for details on format.
     477*/
     478void
     479ParseFcMap(FcChar32 charMap[], FcChar32 baseCodePoint, unicode_block &blocksForMap)
     480{
     481    for (int i = 0; i < FC_CHARSET_MAP_SIZE; ++i) {
     482        FcChar32 curVal = charMap[i];
     483        uint32 rangeStart = 0;
     484
     485        for (int bit = 32; bit > 0; --bit) {
     486            if (curVal & 0x80000000) {
     487                if (rangeStart == 0) {
     488                    rangeStart = bit;
     489                }
     490            } else if (rangeStart > 0) {
     491                uint32 startPoint = baseCodePoint + (32 * i) + (rangeStart - 1);
     492                uint32 endPoint = baseCodePoint + (32 * i) + (bit - 1);
     493
     494                FindBlockForCodepoint(startPoint, blocksForMap);
     495                FindBlockForCodepoint(endPoint, blocksForMap);
     496
     497                rangeStart = 0;
     498            }
     499
     500            curVal <<= 1;
     501        }
     502    }
     503}
     504
     505#endif // FONTCONFIG_ENABLED
     506
     507
     508/*!
     509    \brief Gets a bitmap that indicates which Unicode blocks are in the font.
     510    \param unicode_block to store bitmap in
     511    \return B_OK; bitmap will be empty if something went wrong
     512*/
     513status_t
     514ServerFont::GetUnicodeBlocks(unicode_block &blocksForFont)
     515{
     516    blocksForFont = unicode_block(0LL, 0LL);
     517
     518#ifdef FONTCONFIG_ENABLED
     519    FT_Face face = GetTransformedFace(true, true);
     520
     521    FcCharSet *charSet = FcFreeTypeCharSet(face, NULL);
     522
     523    if (charSet == NULL)
     524        return B_ERROR;
     525
     526    FcChar32 charMap[FC_CHARSET_MAP_SIZE];
     527    FcChar32 next = 0;
     528
     529    FcChar32 baseCodePoint = FcCharSetFirstPage(charSet, charMap, &next);
     530
     531    if (baseCodePoint == FC_CHARSET_DONE)
     532        return B_OK;
     533
     534    ParseFcMap(charMap, baseCodePoint, blocksForFont);
     535
     536    while (next != FC_CHARSET_DONE) {
     537        baseCodePoint = FcCharSetNextPage(charSet, charMap, &next);
     538
     539        ParseFcMap(charMap, baseCodePoint, blocksForFont);
     540    }
     541#endif // FONTCONFIG_ENABLED
     542
     543    return B_OK;
     544}
     545
     546
    440547class HasGlyphsConsumer {
    441548 public:
    442549    HasGlyphsConsumer(bool* hasArray)
  • src/servers/app/ServerFont.h

    diff --git a/src/servers/app/ServerFont.h b/src/servers/app/ServerFont.h
    index b04a7e3..4ef2141 100644
    a b  
    11/*
    2  * Copyright 2001-2008, Haiku.
     2 * Copyright 2001-2017 Haiku.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
    class ServerFont {  
    163163                                               float width) const;
    164164
    165165            Transformable       EmbeddedTransformation() const;
     166            status_t            GetUnicodeBlocks(unicode_block &blocksForFont);
    166167
    167168protected:
    168169    friend class FontStyle;