Converting "fi" into "fi" only requires a lookup table, though fonts can do some pretty fancy things: https://developer.apple.com/fonts/TrueType-Reference-Manual/...
Knowing that "Mr. Smith." is intra-sentence but "Me. Smith." is inter-sentence is well beyond what fonts can do, however.