$37 GRAYBYTE WORDPRESS FILE MANAGER $61

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/libicu/usr/share/doc/alt-libicu-devel/samples/layout/

HOME
Current File : /opt/alt/libicu/usr/share/doc/alt-libicu-devel/samples/layout//ScriptCompositeFontInstance.cpp
/*
 *******************************************************************************
 *
 *   © 2016 and later: Unicode, Inc. and others.
 *   License & terms of use: http://www.unicode.org/copyright.html#License
 *
 *******************************************************************************
 *******************************************************************************
 *
 *   Copyright (C) 1999-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 *******************************************************************************
 *   file name:  ScriptCompositeFontInstance.cpp
 *
 *   created on: 02/05/2003
 *   created by: Eric R. Mader
 */

#include "layout/LETypes.h"

#include "unicode/uscript.h"

#include "FontMap.h"

#include "ScriptCompositeFontInstance.h"

const char ScriptCompositeFontInstance::fgClassID=0;

ScriptCompositeFontInstance::ScriptCompositeFontInstance(FontMap *fontMap)
    : fFontMap(fontMap)
{
    // nothing else to do
}

ScriptCompositeFontInstance::~ScriptCompositeFontInstance()
{
    delete fFontMap;
    fFontMap = NULL;
}

void ScriptCompositeFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
{
    LEErrorCode status = LE_NO_ERROR;
    le_int32 script = LE_GET_SUB_FONT(glyph);
    const LEFontInstance *font = fFontMap->getScriptFont(script, status);

    advance.fX = 0;
    advance.fY = 0;

    if (LE_SUCCESS(status)) {
        font->getGlyphAdvance(LE_GET_GLYPH(glyph), advance);
    }
}

le_bool ScriptCompositeFontInstance::getGlyphPoint(LEGlyphID glyph, le_int32 pointNumber, LEPoint &point) const
{
    LEErrorCode status = LE_NO_ERROR;
    le_int32 script = LE_GET_SUB_FONT(glyph);
    const LEFontInstance *font = fFontMap->getScriptFont(script, status);

    if (LE_SUCCESS(status)) {
        return font->getGlyphPoint(LE_GET_GLYPH(glyph), pointNumber, point);
    }

    return FALSE;
}

const LEFontInstance *ScriptCompositeFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const
{
    if (LE_FAILURE(success)) {
        return NULL;
    }

    if (chars == NULL || *offset < 0 || limit < 0 || *offset >= limit || script < 0 || script >= scriptCodeCount) {
        success = LE_ILLEGAL_ARGUMENT_ERROR;
        return NULL;
    }

    const LEFontInstance *result = fFontMap->getScriptFont(script, success);

    if (LE_FAILURE(success)) {
        return NULL;
    }

    *offset = limit;
    return result;
}

// This is the really stupid version that doesn't look in any other font for the character...
// It would be better to also look in the "DEFAULT:" font. Another thing to do would be to
// look in all the fonts in some order, script code order being the most obvious...
LEGlyphID ScriptCompositeFontInstance::mapCharToGlyph(LEUnicode32 ch) const
{
    UErrorCode  error  = U_ZERO_ERROR;
    LEErrorCode status = LE_NO_ERROR;
    le_int32 script = uscript_getScript(ch, &error);
    const LEFontInstance *scriptFont = fFontMap->getScriptFont(script, status);
    LEGlyphID subFont = LE_SET_SUB_FONT(0, script);

    if (LE_FAILURE(status)) {
        return subFont;
    }

    LEGlyphID glyph = scriptFont->mapCharToGlyph(ch);

    return LE_SET_GLYPH(subFont, glyph);
}



Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.40 PM
root / root
0755
FontMap.GDI
0.416 KB
17 Apr 2019 7.42 PM
root / root
0644
FontMap.Gnome
0.383 KB
17 Apr 2019 7.42 PM
root / root
0644
FontMap.cpp
7.341 KB
17 Apr 2019 7.42 PM
root / root
0644
FontMap.h
1.843 KB
17 Apr 2019 7.42 PM
root / root
0644
FontTableCache.cpp
2.37 KB
17 Apr 2019 7.42 PM
root / root
0644
FontTableCache.h
1.063 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIFontInstance.cpp
9.596 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIFontInstance.h
3.602 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIFontMap.cpp
1.324 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIFontMap.h
1.232 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIGUISupport.cpp
0.842 KB
17 Apr 2019 7.42 PM
root / root
0644
GDIGUISupport.h
0.927 KB
17 Apr 2019 7.42 PM
root / root
0644
GUISupport.h
0.869 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeFontInstance.cpp
5.427 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeFontInstance.h
3.789 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeFontMap.cpp
1.394 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeFontMap.h
1.211 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeGUISupport.cpp
1.049 KB
17 Apr 2019 7.42 PM
root / root
0644
GnomeGUISupport.h
0.938 KB
17 Apr 2019 7.42 PM
root / root
0644
LayoutSample.rc
3.369 KB
17 Apr 2019 7.42 PM
root / root
0644
Makefile
2.918 KB
7 Nov 2019 6.56 AM
root / root
0644
Makefile.in
2.921 KB
17 Apr 2019 7.42 PM
root / root
0644
RenderingSurface.h
1.093 KB
17 Apr 2019 7.42 PM
root / root
0644
Sample.txt
1.657 KB
17 Apr 2019 7.42 PM
root / root
0644
ScriptCompositeFontInstance.cpp
3.197 KB
17 Apr 2019 7.42 PM
root / root
0644
ScriptCompositeFontInstance.h
6.154 KB
17 Apr 2019 7.42 PM
root / root
0644
Surface.cpp
0.871 KB
17 Apr 2019 7.42 PM
root / root
0644
Surface.h
0.507 KB
17 Apr 2019 7.42 PM
root / root
0644
UnicodeReader.cpp
4.104 KB
17 Apr 2019 7.42 PM
root / root
0644
UnicodeReader.h
0.976 KB
17 Apr 2019 7.42 PM
root / root
0644
arraymem.h
0.631 KB
17 Apr 2019 7.42 PM
root / root
0644
cgnomelayout.c
8.445 KB
17 Apr 2019 7.42 PM
root / root
0644
clayout.c
9.824 KB
17 Apr 2019 7.42 PM
root / root
0644
cmaps.cpp
5.301 KB
17 Apr 2019 7.42 PM
root / root
0644
cmaps.h
2.057 KB
17 Apr 2019 7.42 PM
root / root
0644
gdiglue.cpp
1.667 KB
17 Apr 2019 7.42 PM
root / root
0644
gdiglue.h
0.96 KB
17 Apr 2019 7.42 PM
root / root
0644
gnomeglue.cpp
1.643 KB
17 Apr 2019 7.42 PM
root / root
0644
gnomeglue.h
0.963 KB
17 Apr 2019 7.42 PM
root / root
0644
gnomelayout.cpp
8.497 KB
17 Apr 2019 7.42 PM
root / root
0644
gsupport.h
0.361 KB
17 Apr 2019 7.42 PM
root / root
0644
layout.cpp
9.797 KB
17 Apr 2019 7.42 PM
root / root
0644
layout.sln
1.174 KB
17 Apr 2019 7.42 PM
root / root
0644
layout.vcxproj
13.154 KB
17 Apr 2019 7.42 PM
root / root
0644
layout.vcxproj.filters
3.059 KB
17 Apr 2019 7.42 PM
root / root
0644
paragraph.cpp
7.583 KB
17 Apr 2019 7.42 PM
root / root
0644
paragraph.h
2.18 KB
17 Apr 2019 7.42 PM
root / root
0644
pflow.c
9.268 KB
17 Apr 2019 7.42 PM
root / root
0644
pflow.h
0.918 KB
17 Apr 2019 7.42 PM
root / root
0644
readme.html
7.324 KB
17 Apr 2019 7.42 PM
root / root
0644
resource.h
0.886 KB
17 Apr 2019 7.42 PM
root / root
0644
rsurface.cpp
0.695 KB
17 Apr 2019 7.42 PM
root / root
0644
rsurface.h
0.516 KB
17 Apr 2019 7.42 PM
root / root
0644
sfnt.h
4.903 KB
17 Apr 2019 7.42 PM
root / root
0644
ucreader.cpp
0.497 KB
17 Apr 2019 7.42 PM
root / root
0644
ucreader.h
0.412 KB
17 Apr 2019 7.42 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF