D16_D4D_D30.ttf is a font which just contains fake glyphs for those 
unicode points

D16_D4D_D30_random.ttf is a font which just contains fake glyphs for
those unicode points, and a pstf entry for some random combination
of glyphs which we're not going to use.

D16_combined_D4D_D30.ttf is a font which has a pstf table with combos
D4D + D30 and
D30 + D4d

combined_D16_D4D_D30.ttf is a font whch has a pstf table with combos
D16 + D4D + D30 and
D16 + D30 + D4D

Attached are screenshots of the string
D16,D4D,D30 (D16_D4D_D30.txt)
rendered with

vanilla icu 4.0
vanilla pango 1.21.5
vanilla uniscribe 1.0420.2600.2180

with those fonts

a)
The first interesting thing is that with a font with no gsubs the pure 
software reordering for pango and uniscribe *appears* to be the same, i.e
no reordering at all, while the icu and harfbuzz reordering results in glyphs
0d16, 0d30, 0d4d.

But reading http://www.microsoft.com/typography/otfntdev/indicot/shaping.aspx

"The shaping engine finds the base consonant of the syllable, using the
following algorithm: starting from the end of the syllable, move backwards
until a consonant is found that does not have a below-base or post-base form
(post-base forms have to follow below-base forms), or arrive at the first
consonant. The consonant stopped at will be the base."

suggests that the base-consonant should be 0xd16, given that 0xd30 according
to icu and http://www.microsoft.com/typography/otfntdev/indicot/appen.aspx
says that 0d30 (RA) has a post-base form

"If the base consonant is not the last one, Uniscribe moves the halant from the base consonant to the last one. " giving 0d16 0d30 0d4d which is the order
that icu gets, and the order that harfbuzz gets. 

FWIW pango gets different results because 0xd30 has been tweaked to be tagged
as a normal constantant, making 0xd30 the base consontant for the algorithm,
intead of 0xd4d

b) Things get interesting with repeating with D16_D4D_D30_random.ttf. That now
shows that uniscribe is ordering the glyphs as 0d16, 0d30, 0d4d, i.e. agreeing
with icu and harfbuzz and disageeing with pango. Given that the only difference
is the existance of a pstf table, it suggests that uniscribe does agree on the
basic re-ordering mechanism of icu/harfbuzz, except that it has a quirk in that
it won't do it if there is no pstf table in the font, i.e. that the re-ordered
sequence is 0d16, 0d30, 0d4d

c) 
Looking at the same text with D16_combined_D4D_D30.ttf then *both* icu and
uniscribe select the 0d30+0d4d pstf replacement, suggesting that the sequence
sent for gsub processing by uniscribe is actually 0d30,0d4d, matching the order
of icu and harfbuzz of that subsequence, and not 0d4d,0d30
as used by pango. With the clear difference between uniscribe and icu in that
the replacement glyph is ordered at the beginning of the syllable in uniscribe
and to the right in icu. Given b) that seems to suggest that uniscribe may
have a magic extra step in moving the glyph to the start of the sequence
if there has been a pstf replacement, and that step takes place *after* gsub
processing.

d)
Looking at the text with combined_D16_D4D_D30.ttf shows the same results
in icu and uniscribe of 0d16,0d30,0d4d, with no entries in the pstf table used,
while pango used the pstf table for the combo 0d16+0d4d+0d30 combo. Which
further re-inforces that uniscribe agrees with icu (and harfbuzz), and not
pango, that 0d30 should be '_pb'.

Summary:
I'm clueless about Malayalam, but if uniscribe compatibility is of interest
it looks like icu/pango/harfbuzz needs some sort of additional
post-gsub replacement vaguely along the lines of re-ordering the result of a glyph substitution of this type of sequence to the beginning of the syllable ?
and that the pango change to the classification of 0x0d30 looks dubious.
