When you turn on the "defrost windshield" function the a/c turns on automatically to dehumidify the air flowing into the cabin.
If you don't use the "defrost windshield" function, if you choose the air outputs, on some cars if you direct air towards the windshield, you have to have air output to the floor as well, because they assume the passenger compartment is cold if you need to blow air onto the windshield.
If I want to blow air onto the windshield only and not towards the floor, what I have to do in my 2018 Forester is turn on "defrost windshield" and then press a button to turn off a/c. Then I can choose temperature and fan output as desired. I think things worked the same in my 2007 Forester but I don't remember.
If you want to remove moisture from the insides of the windshield and other front windows (and the cabin and the other windows) turn the a/c on which will remove moisture from the incoming air. The incoming air is passed over the cold a/c lines which cools the air, but also removes moisture from the air because condensation will form on the a/c lines and that condensation is water removed from the incoming air. It takes some electrical power to run the a/c compressor, and it takes some heat from the incoming air, but using the a/c and heat at the same time is the quickest way to clear the windows. Sometimes, when multiple people come into the vehicle from the rain, it will get humid in the passenger compartment, and everything in there will get damp, due to condensation and there being a lot of moisture in the car. I will have the a/c on along with a mild amount of heat, and after five minutes or so the cabin is dry enough and I will turn off the a/c but leave the heat on, and drawing air in from outside (outside air is also almost always drier than inside air, so draw outside air when you want to clear the windows). Usually drawing outside air will remove enough humidity that I don't need to keep the a/c on.