none
How to get support code page range of a specific ttf file programmatically? RRS feed

  • Question

  • Dear All,

    How to get the support code page of a specific ttf file programmatically?

    For example, the code page are supported by Microsoft YaHei font are list in red rectangle in the screenshot.

    Thanks and Best regards,

    E-John


    • Edited by E-John Friday, March 15, 2019 12:44 AM
    Thursday, March 14, 2019 2:33 PM

All replies

  • Instantiate the Font class for the font you want to check, then check Font.GdiCharset.
    Friday, March 15, 2019 4:18 AM
    Answerer
  • Dear All,

    It is weird that code page of some common FontFamilies are zero dump by following snippet,

    'Arial' code page are zero.

    Thanks and Best regards,

    E-John

                ICollection<System.Windows.Media.FontFamily> fontFamilies = Fonts.GetFontFamilies(@"C:\Windows\Fonts\");
                foreach(System.Windows.Media.FontFamily family in fontFamilies)
                {
                    Debug.WriteLine(family.Source);
                    Debug.WriteLine(family.FamilyMaps.Count);
                    for (int i = 0; i < family.FamilyMaps.Count; i++)
                    {
                        Debug.WriteLine(family.FamilyMaps[i].Unicode);
                    }
                }

    file:///C:/Windows/Fonts/#Arial
    0
    file:///C:/Windows/Fonts/#Bahnschrift
    0
    file:///C:/Windows/Fonts/#Calibri
    0
    file:///C:/Windows/Fonts/#Cambria

    ...

    file:///C:/Windows/Fonts/#Global User Interface
    176
    0000-052f,0590-06ff,0750-077f,08a0-08ff,1c80-1c8f,1d00-1fff,2c60-2c7f,a720-a7ff,ab30-ab6f,fb00-fb0f,fb1d-fbff
    fc00-fdcf,fdf0-fdff,fe20-fe2f,fe70-fefe
    0530-058f,10a0-10ff,2d00-2d2f,fb10-fb1c
    0700-074f
    0780-07bf
    07c0-07ff
    0900-097f
    0980-09ff
    0a00-0a7f
    0a80-0aff
    0b00-0b7f
    0b80-0bff
    0c00-0c7f
    0c80-0cff
    0d00-0d7f
    0d80-0dff
    0e00-0e7f
    0e80-0eff
    0f00-0fff
    1000-109f,a9e0-a9ff,aa60-aa7f
    1100-11ff,3130-318f,3200-321f,3260-327f,a960-a97f,ac00-d7ff
    1200-139f,2d80-2ddf,ab00-ab2f
    13a0-13ff
    1400-167f,18b0-18ff
    1680-16ff
    1780-17ff,19e0-19ff
    1800-18af
    1950-197f
    1980-19df
    1a00-1a1f
    1c50-1c7f
    202f-202f
    2000-202e,2030-20cf,2150-22ff,2460-25ff,1f780-1f7ff
    2000-202e,2030-20cf,2150-22ff,2460-25ff,1f780-1f7ff
    2000-202e,2030-20cf,2150-22ff,2460-25ff,1f780-1f7ff
    2000-202e,2030-20cf,2150-22ff,2460-25ff,1f780-1f7ff
    2000-202e,2030-20cf,2150-22ff,2460-25ff,1f780-1f7ff
    20d0-20ff
    2100-214f,2300-23ff,2600-27bf
    2100-214f,2300-23ff,2600-27bf
    2100-214f,2300-23ff,2600-27bf
    2100-214f,2300-23ff,2600-27bf
    2100-214f,2300-23ff,2600-27bf
    2400-243f
    2440-245f
    27c0-2bff,1f800-1f8ff
    2c00-2c5f
    2c80-2cff
    2d30-2d7f
    2e00-2e7f
    2e80-2eff
    2e80-2eff
    2e80-2eff
    2e80-2eff
    2e80-2eff
    2f00-2fdf
    2ff0-2fff
    3000-30ff,31f0-31ff
    3000-30ff,31f0-31ff
    3000-30ff,31f0-31ff
    3000-30ff,31f0-31ff
    3000-30ff,31f0-31ff
    3100-312f,31a0-31bf
    3100-312f,31a0-31bf
    3100-312f,31a0-31bf
    3100-312f,31a0-31bf
    3100-312f,31a0-31bf
    3190-319f
    3190-319f
    3190-319f
    3190-319f
    3190-319f
    31c0-31ef
    3220-324f,3251-325f,3280-32cb,32d0-3376,337b-337f,33e0-33ff
    3220-324f,3251-325f,3280-32cb,32d0-3376,337b-337f,33e0-33ff
    3220-324f,3251-325f,3280-32cb,32d0-3376,337b-337f,33e0-33ff
    3220-324f,3251-325f,3280-32cb,32d0-3376,337b-337f,33e0-33ff
    3220-324f,3251-325f,3280-32cb,32d0-3376,337b-337f,33e0-33ff
    3250-3250,32cc-32cf,3377-337a
    3380-33df
    3380-33df
    3380-33df
    3380-33df
    3380-33df
    3400-4dbf,4e00-9fff
    3400-4dbf,4e00-9fff
    3400-4dbf,4e00-9fff
    3400-4dbf,4e00-9fff
    3400-4dbf,4e00-9fff
    3400-4dbf,4e00-9fff
    4dc0-4dff
    a000-a4cf
    a4d0-a4ff
    a500-a63f
    a700-a71f
    a840-a87f
    a980-a9df
    e76c-e76c,e78d-e796,e7c7-e7c8,e7e7-e7f3,e815-e864
    e76c-e76c,e78d-e796,e7c7-e7c8,e7e7-e7f3,e815-e864
    e000-eeb7,f303-f34b,f3a0-f5f1,f634-f848
    f900-faff
    f900-faff
    f900-faff
    f900-faff
    f900-faff
    fe10-fe1f
    fe10-fe1f
    fe10-fe1f
    fe10-fe1f
    fe10-fe1f
    fe30-fe6f
    fe30-fe6f
    fe30-fe6f
    fe30-fe6f
    fe30-fe6f
    feff-feff
    ff00-ff60
    ff00-ff60
    ff00-ff60
    ff00-ff60
    ff00-ff60
    ff61-ff9f
    ff61-ff9f
    ff61-ff9f
    ff61-ff9f
    ff61-ff9f
    ffa0-ffdc
    ffa0-ffdc
    ffa0-ffdc
    ffa0-ffdc
    ffa0-ffdc
    ffe0-ffee
    ffe0-ffee
    ffe0-ffee
    ffe0-ffee
    ffe0-ffee
    fff0-fffd
    10280-1029f,102a0-102df
    10300-1034f
    10380-1039f,103a0-103df
    10400-1044f
    10450-1047f
    10480-104af
    10800-1083f,10840-1085f
    10900-1091f,10920-1093f
    109a0-109ff
    10a00-10a5f,10a60-10a7f
    10b40-10b5f,10b60-10b7f
    10c00-10c4f
    11000-1107f
    110d0-110ff
    12000-123ff,12400-1247f
    13000-1342f
    1b000-1b0ff
    1d300-1d35f
    1d400-1d7ff
    1f000-1f6ff,1f900-1f9ff
    20000-2a6df
    20000-2a6df
    20000-2a6df
    20000-2a6df
    20000-2a6df
    20000-2a6df
    2a700-2b81f
    2a700-2b81f
    2a700-2b81f
    2a700-2b81f
    2a700-2b81f
    2a700-2b81f
    2b820-2ceaf
    2f800-2fa1f
    2f800-2fa1f
    2f800-2fa1f
    2f800-2fa1f
    2f800-2fa1f
    2f800-2fa1f

    Friday, March 15, 2019 5:47 AM
  • I think your code is answering a different question (finding Unicode Language instead of CodePage).In font format, codepage supported is governed by a 64-bit field and is enabled by setting 1s on the bits you want to enable. So the number of supported code pages is limited to the referenced webpage.

    Friday, March 15, 2019 9:04 AM
    Answerer