[xsl] Boolean logic

Subject: [xsl] Boolean logic
From: davep <davep@xxxxxxxxxxxxx>
Date: Thu, 29 Dec 2011 14:48:14 +0000
Using xslt 2.0
I have a matrix, representing a font file, one bit per glyph.
Example below.
Each bit implies glyph at that position is present (1)
or missing (0)
Each line represents 255 glyphs.
Full matrix 00..ff represents ... a lot of glyphs.


E.g. glyph A1 is first row, 6th data group. I'm looking for a function to test if a particular glyph is present.

E.g. Is 0x3A0 present? This is pi, and is present.
My p-code is
Select line:
  if n < 100 then 1
  if n < 200 then 2
  if n < 300 then 3
 etc.

Having determined which line:
 Normalize to 0..FF, n mod 0x100



Within a line:
E.g. A1 is the A div 2 = 5, hence 5+1 = 6th group, first bit.
       0x21 is  2 div 1 = 1, hence  1 +1 = 1st group, first bit.

Question.
  Is my logic right (given the problem is as explained - I can't
find an algorithm for font-config, fc-query command).
  If not, where is it wrong please?
 then, can anyone devise a function
which given the matrix below, and a hex number, e.g. 0xA1,
return the true/false state I.e. the glyph is present or not?


TIA DaveP





<glyphs> <line><base>0000</base><gp>00000000</gp><gp>ffffffff</gp><gp>ffffffff</gp><gp>7fffffff</gp><gp>00000000</gp><gp>ffffdffe</gp><gp>ffffffff</gp><gp>ffffffff</gp></line> <line><base>0001</base><gp>ffffffff</gp><gp>feffffff</gp><gp>ffffffff</gp><gp>ffffffff</gp><gp>00040000</gp><gp>00818003</gp><gp>00000000</gp><gp>fc300000</gp></line> <line><base>0002</base><gp>03000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00040000</gp><gp>01850000</gp><gp>3f0000c0</gp><gp>00000008</gp></line> <line><base>0003</base><gp>00040200</gp><gp>00000008</gp><gp>00000000</gp><gp>44300000</gp><gp>ffffd7f0</gp><gp>fffffffb</gp><gp>44637fff</gp><gp>00000001</gp></line> <line><base>0004</base><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>000c0000</gp><gp>000000c0</gp></line> <line><base>001e</base><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>0000003f</gp><gp>ffffffff</gp><gp>ffffffff</gp><gp>03ffffff</gp></line> <line><base>001f</base><gp>3f3fffff</gp><gp>ffffffff</gp><gp>aaff3f3f</gp><gp>3fffffff</gp><gp>ffffffff</gp><gp>ffdfffff</gp><gp>efcfffdf</gp><gp>7fdcffff</gp></line> <line><base>0020</base><gp>7fff0bf4</gp><gp>560d0067</gp><gp>00000010</gp><gp>fff10000</gp><gp>00007fff</gp><gp>0000109e</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>0021</base><gp>00480020</gp><gp>00004044</gp><gp>fff80000</gp><gp>00000000</gp><gp>00200000</gp><gp>00000100</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>0022</base><gp>44068044</gp><gp>00000f80</gp><gp>00000120</gp><gp>00000033</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>0023</base><gp>00010000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>0025</base><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000c02</gp><gp>00008400</gp><gp>00000040</gp></line> <line><base>00e0</base><gp>00000000</gp><gp>00000000</gp><gp>00000070</gp><gp>00000800</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>00f5</base><gp>07fdffff</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>00f6</base><gp>00000000</gp><gp>fe000000</gp><gp>7fe30007</gp><gp>ffffe7fe</gp><gp>ffffffff</gp><gp>000c3fff</gp><gp>3001ce08</gp><gp>ffffff15</gp></line> <line><base>00f7</base><gp>00000000</gp><gp>83ff0052</gp><gp>00000000</gp><gp>07ffffff</gp><gp>00000000</gp><gp>81108102</gp><gp>00000000</gp><gp>ff7fffff</gp></line> <line><base>00fb</base><gp>0000001f</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp></line> <line><base>00ff</base><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>00000000</gp><gp>10000000</gp></line> </glyphs>


regards


--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

Current Thread