Implement glyph attribute handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31730 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-12-13 21:26:15 +00:00
parent 77495ccde1
commit cdb08be089
4 changed files with 60 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2010-12-13 Fred Kiefer <FredKiefer@gmx.de>
* Headers/Additions/GNUstepGUI/GSLayoutManager_internal.h,
* Headers/Additions/GNUstepGUI/GSLayoutManager.h,
* Source/GSLayoutManager.m (-intAttribute:forGlyphAtIndex:)
(-setIntAttribute:value:forGlyphAtIndex:): Implement glyph
attribute handling.
2010-12-13 Jonathan Gillaspie <jonathan.gillaspie@testplant.com>
* Source/NSMenuView.m:

View file

@ -45,6 +45,15 @@ typedef enum
NSGlyphInscribeOverBelow = 4
} NSGlyphInscription;
enum {
NSGlyphAttributeSoft = 0,
NSGlyphAttributeElastic = 1,
#if OS_API_VERSION(MAC_OS_X_VERSION_10_2, GS_API_LATEST)
NSGlyphAttributeBidiLevel = 2,
#endif
NSGlyphAttributeInscribe = 5
};
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
@interface GSLayoutManager : NSObject <NSGlyphStorage, NSCoding>
#else

View file

@ -83,12 +83,14 @@ typedef struct
is necessary, the mapping will have to be range to range. (Eg. if you
have characters 'ab' mapped to glyphs 'AB', reordered to 'BA', then the
range 'ab' will be mapped to the range 'BA'. */
unsigned int char_offset:21; /* This could be made a lot smaller, if necessary */
unsigned int char_offset:18; /* This could be made smaller, if necessary */
unsigned int drawsOutsideLineFragment:1;
unsigned int isNotShown:1;
unsigned int inscription:3;
/* 3 unused */
unsigned int soft:1;
unsigned int elasitc:1;
unsigned int bidilevel:7; // Need to support 0..61
} glyph_t;

View file

@ -1749,7 +1749,25 @@ places where we switch.
- (int) intAttribute: (int)attributeTag
forGlyphAtIndex: (unsigned int)glyphIndex
{
[self subclassResponsibility: _cmd];
glyph_run_t *run;
glyph_t *g;
unsigned int pos;
run = run_for_glyph_index(glyphIndex, glyphs, &pos, NULL);
if (run && run->glyphs && (run->head.glyph_length < glyphIndex - pos))
{
g = &run->glyphs[glyphIndex - pos];
if (attributeTag == NSGlyphAttributeInscribe)
return g->inscription;
else if (attributeTag == NSGlyphAttributeSoft)
return g->soft;
else if (attributeTag == NSGlyphAttributeElastic)
return g->elasitc;
else if (attributeTag == NSGlyphAttributeBidiLevel)
return g->bidilevel;
}
return 0;
}
@ -3174,9 +3192,25 @@ forStartingGlyphAtIndex: (NSUInteger)glyph
value: (NSInteger)anInt
forGlyphAtIndex: (NSUInteger)glyphIndex
{
// FIXME
[self subclassResponsibility: _cmd];
}
glyph_run_t *run;
glyph_t *g;
unsigned int pos;
run = run_for_glyph_index(glyphIndex, glyphs, &pos, NULL);
if (run && run->glyphs && (run->head.glyph_length < glyphIndex - pos))
{
g = &run->glyphs[glyphIndex - pos];
if (attributeTag == NSGlyphAttributeInscribe)
g->inscription = anInt;
else if (attributeTag == NSGlyphAttributeSoft)
g->soft = anInt;
else if (attributeTag == NSGlyphAttributeElastic)
g->elasitc = anInt;
else if (attributeTag == NSGlyphAttributeBidiLevel)
g->bidilevel = anInt;
}
}
/*
* NSCoding protocol