“How is your viewpoint on transgender people” will create quite an awkward situation because most people don’t have any viewpoint on the matter. It’s not important to them. It’s important to you, for obvious reasons, but not to most people.
My boss had an employee who came out as a transgender woman, and his reaction was: So what? That was actually the reaction of more than 90% of the employees as well. They didn’t really have a viewpoint, it just wasn’t important to them.
I think few people are specifically anti-transgender. There are people who are anti-lots if things. If your boss is say anti-Hindu and anti-Mexican then there’s a good chance he or she is anti-more things. If you haven’t heard your boss making nasty comments about any minority then it is not very likely he is anti-transgender. So if you correctly judge whether or not he or she is a decent person, you should be fine.
On the other hand, if your boss has indicated that he has problems with some minorities then there is a good chance that both coming out and asking about his viewpoint will have the same negative consequences for you.
Summary: If you think your boss is a decent person, come out. If not: Tread carefully.
PS. Going out after work for a beer with an obviously transgender woman in our middle as part of the group was interesting. She was one of us, who might need protection (because sometimes you do run into idiots), and that protection would have been there because she was one of us.
PS. Talking about a friend of yours who just came out, totally to your surprise, at another company obviously, might get you some hints. Depending on the feedback you get, take into account that some people don’t always act in an adult way. If the reaction is hostility, take it seriously. If the reaction is laughter, it will likely be better in a real situation.
PS. You have the very reasonable wish to (a) come out and (b) not to lose your job. Took me ages to realise that you can at least reduce the risk by first checking your chances of finding a job elsewhere if things go bad. (My assumption here was that you still look male, so if you tell your boss you want to transition and get fired for that - which I say should never happen - you could still get a job elsewhere as a male; far from perfect but better than jobless. )
PS. I figured out why I really felt that asking your boss about his viewpoint is a bad idea. Your boss really wants an easy life with no distraction from his business. If you come out as transgender from his business point of view very little to nothing changes. But if you want to know about transgender rights, that’s a distraction without any business value, so he won’t like that.