From: Khaled H. <kha...@eg...> - 2013-02-13 23:34:38
|
On Mon, Jan 14, 2013 at 11:03:43AM +0000, Martin Hosken wrote: > On Sat, 12 Jan 2013 19:27:48 +0200 > Khaled Hosny <kha...@eg...> wrote: > > > On Sat, Jan 12, 2013 at 04:34:14PM +0000, Martin Hosken wrote: > > > > > > Dear Khaled, > > > > > > > I don’t seem to find the Graphite2 API for finding the default setting > > > > of a value, did I miss something or no such API is avialable, and, if > > > > yes, why? > > > > > > Can you tell me a bit more about which value you are wanting to query of what object? > > > > I’m trying to find the default setting for any given feature (i.e. the > > .default member of the feature in GDL), for two uses: XeTeX has a > > primitive that tells if a given feature setting is the default or not, > > and to find which setting to use when user specifies a feature with no > > value, e.g.: > > > > \font\foo="Foo/Gr:Alternate Shape" > > > > as opposed to: > > > > \font\foo="Foo/Gr:Alternate Shape=1" > > > > You are correct in saying that there is no direct API to give you your > answer. But there is a pretty easy workaround. > > The first question you have to answer is whether you want your default > to be a language independent default or whether what you want is a > language tuned default. If someone sets the language attribute, do you > want that to set give the default or do you want the default to ignore > that language attribute? The XeTeX primitives affected by this query the font as defined by the user, so the language dependence depends on whether the user defined the font with a language or not i.e. what XeTeX should report is the behaviour that the font as defined by the user would exhibit. > The Graphite API allows you to create a feature value which holds all > the values for all the features in a font > (gr_face_featureval_for_lang). You can create one based on no language > or on a particular language. You can then query this using a feature > ref to find the default value for that feature > (gr_fref_feature_value). > > Does that scratch the itch? I'm starting to think that I had a big misunderstanding on what "default" in GDL feature definition means, I thought it mean the default setting of the feature when user activates it, but now I'm starting to think it means the default behaviour of the font if the user did not explicitly enable that feature, if my later understanding is true then this explains a lot and gr_face_featureval_for_lang() would be indeed what I was looking for. Regards, Khaled |