Disclosed are various embodiments of high-speed, high-performance, low-noise, low-cost, compact, optical encoders having a multi-faceted flat-faced lens is disposed over the light emitters and light detectors thereof. Disclosed also are various means for preventing undesired stray light from reaching light detectors incorporated therein. Structures employed to block stray light in the optical encoders include light barriers, air gap trenches, and coatings disposed between first and second sides of a substrate of the encoder. Methods of making such optical encoders are also disclosed.